Skip to content

Commit

Permalink
#177 | Minor addition to env vars and Readme notes
Browse files Browse the repository at this point in the history
  • Loading branch information
himeshr committed Jul 29, 2024
1 parent 08230be commit d7014b3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
Connecting local avni-media to server/etl on another environment like staging leads to CORS errors.

Thus, for local development on avni-media, other avni components like `avni-server` and `avni-etl` need to be running locally with an IDP enabled i.e. Cognito or Keycloak.

### Other Avni Components

#### Environment Variables
Ensure that local `avni-server` and `avni-etl` have the following environment variables set
I. Ensure that local `avni-server` and `avni-etl` have the following environment variables set
```
AVNI_IDP_TYPE
OPENCHS_CLIENT_ID
Expand All @@ -21,6 +23,19 @@ OPENCHS_KEYCLOAK_CLIENT_SECRET
OPENCHS_KEYCLOAK_ENABLED
```

II. Alternately, to work with Staging env IDP and Storage, you may use the following Make command in both avni-server and avni-etl. If required, override the DB and other details, Ex: OPENCHS_DATABASE_NAME=avni_org

```
## Init below fields in env variables
OPENCHS_STAGING_APP_CLIENT_ID
OPENCHS_STAGING_USER_POOL_ID
OPENCHS_STAGING_IAM_USER
OPENCHS_STAGING_IAM_USER_ACCESS_KEY
OPENCHS_STAGING_IAM_USER_SECRET_ACCESS_KEY
make start_server_staging OPENCHS_DATABASE_NAME=<your_db_name>
```

### Avni Media
There is a `local.staging` environment template configured for `client` and `server` that help with running `avni-media` locally.
Look at `client/middleware.js` which takes care of routing the request to local `avni-server` and `avni-etl` in this mode.
Expand Down
6 changes: 5 additions & 1 deletion client/env-templates/local.staging.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
NEXT_PUBLIC_ETL=/etl
NEXT_PUBLIC_MEDIA_VIEWER=/media-viewer
NEXT_PUBLIC_MEDIA_VIEWER=http://localhost:3010/media-viewer
NEXT_PUBLIC_WEB=
NEXT_PUBLIC_WEBAPP_BASE_URL=http://localhost:6010
NEXT_PUBLIC_ENVIRONMENT=dev

# Actual Service URL to be used only next JS middleware
NEXT_PUBLIC_ETL_MIDDLEWARE=http://localhost:8022
NEXT_PUBLIC_WEB_MIDDLEWARE=http://localhost:8021

0 comments on commit d7014b3

Please sign in to comment.