diff --git a/app/.env.example b/app/.env.example index ca30050..826765a 100644 --- a/app/.env.example +++ b/app/.env.example @@ -1,6 +1,6 @@ SSO_URL=https://dev.loginproxy.gov.bc.ca/auth/realms/standard -SSO_CLIENT_ID=sso-requests -SSO_CLIENT_SECRET=sso-requests-secret +SSO_CLIENT_ID=<> +SSO_CLIENT_SECRET=<> SSO_REDIRECT_URI=http://localhost:3000 SSO_LOGOUT_REDIRECT_URI=http://localhost:3000 SSO_AUTHORIZATION_RESPONSE_TYPE=code @@ -19,8 +19,8 @@ JWT_SECRET=verysecuresecret JWT_TOKEN_EXPIRY=1h PGHOST=localhost PGPORT=5432 -PGUSER= -PGPASSWORD= +PGUSER= +PGPASSWORD= PGDATABASE=realm_registry PGSSL=false APP_ENV=development @@ -39,7 +39,7 @@ TF_GH_REPO= TF_MODULE_GH_REF= GH_ACCESS_TOKEN= GH_API_TOKEN= -DATABASE_URL= +DATABASE_URL=postgresql://:@localhost:5432/realm_registry IDIR_REQUESTOR_USER_GUID= MS_GRAPH_API_AUTHORITY= MS_GRAPH_API_CLIENT_ID= diff --git a/app/README.md b/app/README.md index bdf0fc5..b2b611f 100644 --- a/app/README.md +++ b/app/README.md @@ -2,7 +2,24 @@ This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next ## Getting Started -First, run the development server: +In the app folder run: + +Run `make local-setup` + +Create the `.env` file from the `.env.example` file in the app folder. + +The values can be found in the project's non-prod vault file. The local database creds are username "postgres", password is the local password for your database. + +The CHES config can be changed. If you need to connect to the production CHES the config can be copied from the AWS dev environment variables for the sso-request lambda function. + +Update the '' value with a local postgres username in the `app/db/setup.sh` file. In the folder `app/db/` run: + +``` +pg_ctl start +./setup.sh +``` + +Then run the development server: ```bash npm run dev diff --git a/app/db/setup.sh b/app/db/setup.sh index dc1ca97..4659ba8 100755 --- a/app/db/setup.sh +++ b/app/db/setup.sh @@ -6,6 +6,8 @@ else db="realm_registry" fi -echo "SELECT 'CREATE DATABASE $db' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '$db')\gexec" | psql -d postgres +postgres_username=<> -psql -d $db -f "../../helm/webapp/migration.sql" -qtA --set ON_ERROR_STOP=1 +echo "SELECT 'CREATE DATABASE $db' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '$db')\gexec" | psql -U $postgres_username -d postgres + +psql -U $postgres_username -d $db -f "../../helm/webapp/migration.sql" -qtA --set ON_ERROR_STOP=1 diff --git a/docs/local-development-guid.md b/docs/local-development-guid.md index 2c7352f..d970510 100644 --- a/docs/local-development-guid.md +++ b/docs/local-development-guid.md @@ -6,7 +6,7 @@ Run through the steps in [developer guide](./developer-guide.md) ## How to run the project locally -**TO DO** +The local development commands can be found in the [app README](../app/README.md) ## Building and deploying test images.