From d7014b3c69d0585b0ca1967fbdb3412c102a8f50 Mon Sep 17 00:00:00 2001 From: himeshr Date: Mon, 29 Jul 2024 10:45:38 +0530 Subject: [PATCH] avniproject/avni-media#177 | Minor addition to env vars and Readme notes --- README.md | 17 ++++++++++++++++- client/env-templates/local.staging.template | 6 +++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b922491..a3af688 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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= +``` + ### 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. diff --git a/client/env-templates/local.staging.template b/client/env-templates/local.staging.template index a1ff05d..91e1aef 100755 --- a/client/env-templates/local.staging.template +++ b/client/env-templates/local.staging.template @@ -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