Skip to content

Commit

Permalink
feat: introduce config environment variable (#3006)
Browse files Browse the repository at this point in the history
* ignore .next in jest

* mute console error from jest results

* rename app_env to nbs_auth

docker compose --env-file .env.local --profile "*" up to test with different configs

* Remove app env check around s3 client

* add collection variables for env groups

* fix typos in .env files

* create single azure-storage image that contains both azurite and azure cli

* add additional chaining to run specific collections

* fix local-dev command to use collection

* update create-seed-data to use different configs depending on metadata

* rename schemas

* update .env.sample to include collection

* remove azure-storage-init from orchestration

* update orchestration docker compose to add collection

* add metadata db schema in the env variable

* remove undefined values

* remove nbs_auth value

* Remove redundant variables

* change to aws non integrated and add timeout

* add docker ignore

* add more to docker ignore

* Comment all from .env

* fix tests that were relying on .env file

* make metadata variables optional

* pull out saveFhirMetadata into it's own function

* delete .env

* Use PersistenceResponse instead of Nextjs response

* console log error messages

* Do not close pool when done with mssql

https://www.npmjs.com/package/mssql#advanced-pool-management:~:text=Also%20notice%20that,of%20the%20script.

* increase sqlserver timeout to 30 s

* don't return anything from save ecr data query

* be more specific with env variable names

* remove return for ecr data

* update .env.sample variables

* remove .env

* Remove app_env from dockerfile

* make metadata env variable optional

* fix tests without .env

* move getDb from top level to be inside methods

* add dockerignore

* Remove NEXT_PUBLIC_BASEPATH since it is determined at build time anyways

* fix first batch of seed script conflicts

* use rewrite instead of redirect to keep url

* set pool min to 1

* fix middleware test after changes to middleware rewrite to error page

* replace dotenvx with next runtime env and instrumentation

* remove console logs

* update collection in orchestration

* change docker compose collection to default to sql server non integrated

* Rename PersistenceResponse to SaveResponse

* Remove build from convert-seed-data

* remove useless console.error logs

* update instrumentation tests

* fix middleware

* permanently set base path in ecr-viewer

* Rename middleware to be a .ts file

* replace a tags with Next's Link tag

* remove title from Header link

* retype base_path to be a string

* fix metrics test

* update header snapshot test

* address middleware tests

* add back button to retrieval failed

* remove unused rewrite in next config

* update matcher

* Prevent access to /api/fhir-data

* [pre-commit.ci] auto fixes from pre-commit hooks

* fix url in readme

* remove accident commited next-runtime-env

* [pre-commit.ci] auto fixes from pre-commit hooks

* use next-runtime-env to access NEXT_PUBLIC_NON_INTEGRATED

* [pre-commit.ci] auto fixes from pre-commit hooks

* use proper variable name for middleware test

* simplify clear-local command

* rename collection to CONFIG_NAME

* update design script to handle config variable

* fix package.json

* update lighthouse startup

* add dummy keys to .env.sample

* Filter by conditions in eCR Library (frontend) (#2981)

* First pass, filter conditions functionality

* add select/deselect all functionality

* update some styling, maintain checkbox state when toggling filter button

* styling updates, wip

* checkbox color, add icon, add uswds sprite.svg to assets

* adjust padding to fix checkbox focus ring cut off

* fix icon not displaying by adding static file route

* fix unintentional scrolling bug

* update filter row top border

* wip, add comments, decompose conditions filter to separate const

* fix scrolling bug by adding position-relative

* add snapshot and unit tests

* add JSDocs

* remove css classes and use utilities instead

* update snapshot test

* update select all/deselect all functionality s.t. default is all conditions checked, update tests

* update so that filters reset if clicking off filter before clicking the Apply button, add tests

* update basepath so it works in prod

* update tests

* update styles in diff button states, update icon size, make capitalization consistent

* Remove log

Co-authored-by: Mary McGrath <[email protected]>

* use as form/fieldset, update sync state bug, update tests

* remove manual checkboxing for select all, lets react handle the render

* rework state management, update tests

* code review changes, minor

* query should persist over a reload

* update backend so default (all conditions) would leave out condition param from URL query, add/update tests

* use import for icon

* Update base_path env var name

Co-authored-by: Boban <[email protected]>

* update snapshot test

* re-use resetFilterConditions

* one more nit

* update ecr library height to accommodate fiter bar

* update env var name for base path

---------

Co-authored-by: Mary McGrath <[email protected]>
Co-authored-by: Boban <[email protected]>

* fix base path for filters

* update config name in create-seed-data

* move start transaction in the if statement for saveMetadataToSqlServer

* remove random transaction from conditons api sql server

* move start transaction in the if statement for saveMetadataToSqlServer

* remove random transaction from conditons api sql server

* [pre-commit.ci] auto fixes from pre-commit hooks

* refactor service for condition to simplify logic

* [pre-commit.ci] auto fixes from pre-commit hooks

* update filter test

* update jsdocs

* add nbs pub key to environment variables

* remove NBS_AUTH variable from local environment setup

* fix broken merge

* fix where clause fpor date statement sql server

* Update .env.sample to replace mssql server_server with server_host

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Angela The <[email protected]>
Co-authored-by: Mary McGrath <[email protected]>
  • Loading branch information
4 people authored Jan 2, 2025
1 parent 9112d57 commit 61ac6d5
Show file tree
Hide file tree
Showing 46 changed files with 390 additions and 112 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/container-ecr-viewer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
node-version: ${{env.NODE_VERSION}}

- name: Start app
run: docker compose --env-file .env.test --profile postgres --profile ecr-viewer up -d
run: CONFIG_NAME=AWS_SQLSERVER_NON_INTEGRATED docker compose --profile AWS_SQLSERVER_NON_INTEGRATED --profile ecr-viewer up -d
working-directory: ./containers/${{env.CONTAINER}}

- name: Wait for Application to be ready
Expand Down Expand Up @@ -153,6 +153,7 @@ jobs:

convert-data:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -167,5 +168,5 @@ jobs:
working-directory: ./containers/${{env.CONTAINER}}

- name: Run seed data conversion
run: npm run convert-seed-data:build
run: npm run convert-seed-data
working-directory: ./containers/${{env.CONTAINER}}
79 changes: 72 additions & 7 deletions containers/ecr-viewer/.env.sample
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
APP_ENV=test
NEXT_PUBLIC_NON_INTEGRATED_VIEWER=true
SOURCE=postgres
CONFIG_NAME=AWS_SQLSERVER_NON_INTEGRATED

# Azure Connection
AZURE_STORAGE_CONNECTION_STRING="DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://localhost:10000/devstoreaccount1;"
Expand All @@ -13,12 +11,79 @@ ECR_BUCKET_NAME=ecr-viewer-files
AWS_ACCESS_KEY_ID=123
AWS_SECRET_ACCESS_KEY=xyz

# Metadata
# Postgres
DATABASE_URL=postgres://postgres:pw@localhost:5432/ecr_viewer_db
METADATA_DATABASE_TYPE=postgres
METADATA_DATABASE_SCHEMA=core

# SQL Server
SQL_SERVER_USER=sa
SQL_SERVER_PASSWORD=Password1!
SQL_SERVER_SERVER=sqlserver
SQL_SERVER_HOST=sqlserver


# Auth - For testing use only
NBS_PUB_KEY="-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnlA1YmmbydxQdBh7DAq0
wUfsjR25eWZOB995mHclT3C46oLat3YLu70akLfoMXd9YcJe0d4q3sP7tS1J4QDO
IkfapvK3ClDJR2VUERTzR9yQ+1B1Sd+MSful/V3aP9L6wPRAJmsmziizUBz+X0oN
WTkGP/xi0F/IlyBfh2sk89JKKmgXSFbgDTD7+8L5WeRY5koR0KfDJLBcyerrcIPW
1FyD8RbkUH78yJXc+/ThXKBNpsDTvV0k/4zqLSADIEmhQFkW8oYOfF4ufBGSnGdZ
gPoWbKHtlK+m1sFWMq0hAtJsNKsJQocPAEO2NIxRCX4k6X9HfvCYVniDI4OdVz0V
jTF+galQDAybgtYc9ZN8ROpePDVkCANHzniBJFOwzv2yekreqdX7M399uLB+ztDX
Iz2RpZbGkgspl4TWvvB+eN64DJykmExImIw1nFc/6AVd3jhKSnCrckpGV3XaF8lW
WMA6au0RXjmRa4YxO/uQbFZeFkM7aQtQK/CxqdBfG0SACcIMwU2S7Kb5+c9Hs687
LI8j7j0oVyCiAyJ44Mi70i4A2GedyM6kzdixTmszin+c4tT8mYjmEMpJle6GLBIa
aqEy3CVEqecFIo4ypfoo4GjTqvv/JjtxwBl1FPC+HzFkOjSoLbrDmn64NnQhXlC9
kd+ONf43CmqDSTa3atSFq4sCAwEAAQ==
-----END PUBLIC KEY-----"

DUMMY_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----
MIIJJwIBAAKCAgEAnlA1Ymmbyd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gI2xvNatMIYzOG8dEbG0Es0AWy
gi/Qj8POM3IJzBM9N3z0kPj4KS+M4v/Ewa0Gy4Jh7ivvqnksah4am+HiilxwyQWx
fsOngwt4FxWTS3lFknFib1ykzlHmTuhwsP2njvM2fhFmGdwP//0DwLZDoIitn70B
6hsTET+WM2RvVlGkOWJq4Ud+ANVBdXQtitPmt3fSC5zxUw88ou8yaVDOg5cXa+zz
Un/6xV+z/pVU3yKlbf7r17grD89pYPDahavgDEX0AG+ZfftnSNepMQRGYDDs6Ynx
b2nxAoIBAHjrb0Z2R+mOwBq7bwxES9Jo0z2X+5qnvXxLCH6jiO1/x4CWhr6y7Kpu
PqWObuRr+z4WMUxZnddfpLJW2piQBpkUNG39Fdq3/eDEtchI5ScTlN5h8PpdPCBa
mT6Nj+yz77OifSWnem40I8zWTTYIEOTg3xujqMzGpEooEowHM866QUnpl/mmTUs/
HARHSxfHuQ9n/2RQVMpgW6D+QwlBPfqCAnHKXt4A/Rzik/8+HBYm3eIEB5tCIBDq
TBaZD68R2hOifGFQNXA5ncA20ov2o0lNMNOgAGdckhRPtrxloFoen6i8l74qFkCu
UNVLDE2zXANd4VxufHJ7Jd5iKhMUKbECggEAO7aDLDXDIbU8+2tIXSB3bUFhXi0l
XQY2kSVQj/Q/kbOiy9UbfWr76xX2pOtPMRi/h7Juhxvfrlw2X80QzehBsP/Tu7dY
4j5nKfyXXGdoKdm28BySZM9via0ShN/IT4O208VKFtQRevfiUmQO+Mm3Xu5Wzxza
/7H6rq2mvsUgPVvsHZ5pM80hs1+nPa0kXPmTMqNp+vEk8+oaNAeVWcmds3uGWhJi
gIZiNO3MBX0aeeF7ic/JF2gmLXf/KAVzrkSynowwz3ZUeDsw2DeaL5A1zEOSHaMG
x4cpSw6JQiewiTjTdIMT+IU4+OAvKPkmzMFM+UYTdy1sTFvTNloXWpGrLQ==
-----END RSA PRIVATE KEY-----"
1 change: 0 additions & 1 deletion containers/ecr-viewer/.env.test
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
DATABASE_URL=postgres://postgres:pw@postgres:5432/ecr_viewer_db
APP_ENV=test
AZURE_CONTAINER_NAME=ecr-viewer-files
2 changes: 1 addition & 1 deletion containers/ecr-viewer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ ENV OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://otel-collector:4318/v1/traces

# server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
CMD node server.js
CMD ["node", "server.js"]
6 changes: 4 additions & 2 deletions containers/ecr-viewer/api-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ Display an eCR

**URL** : `/view-data?id=:id&snomed-code=:snomed&auth=:auth`

**URL Parameters** :
**URL Parameters** :

- `id=[string]` where `id` is the ID of the eCR.
- `snomed-code=[string]` where `snomed-code` is the condition the user is viewing the eCR for. OPTIONAL.
- `auth=[string]` where `auth` is the authentication token for the user. Only required if app_env is production.
- `auth=[string]` where `auth` is the authentication token for the user. Only required if NBS_AUTH is true.

**Method** : `GET`

Expand All @@ -16,6 +17,7 @@ Display an eCR
**Permissions required** : None

## Example Architecture

![NBS -> ECR Viewer sequence diagram](assets/nbs-ecr-viewer-arch.png)

## Success Response
Expand Down
2 changes: 1 addition & 1 deletion containers/ecr-viewer/cypress/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ services:
- "3000:3000"
environment:
- DATABASE_URL=${DATABASE_URL:-postgres://postgres:pw@db:5432/ecr_viewer_db}
- APP_ENV=${APP_ENV:-prod}
- NBS_AUTH=${NBS_AUTH:-true}
14 changes: 10 additions & 4 deletions containers/ecr-viewer/design-review/design-review.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,28 @@ npm i

# Write env vars to .env.local
npm run setup-local-env
echo "NEXT_PUBLIC_NON_INTEGRATED_VIEWER=$IS_NON_INTEGRATED" >> .env.local

if [ "$IS_NON_INTEGRATED" = true ]; then
echo "CONFIG_NAME=AWS_SQLSERVER_NON_INTEGRATED" >> .env.local
URL="http://localhost:3000/ecr-viewer"
else
echo "CONFIG_NAME=AWS_INTEGRATED" >> .env.local
URL=http://localhost:3000/ecr-viewer/view-data?id=6100896d-b520-497c-b2fe-1c111c679274&auth=eyJhbGciOiJSUzI1NiIsImlkIjoiYmxhaCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.hXmX6wu9ThiSqNEl6Y3pBETppiIt0j4RKSVPO_AAYZJZsngSFiu8GuGDtA13kJ-texfUHshqcy4euoVwfmN-naDi2Ly6p6lPjY6xzmTuQ1DtiKLZDNBsDupjoLAuIJQ3K8uWRnCdRGG1ZlTkZa-SG8b4jfDLRrl1fPiJCWM62XV7_gIvqCvRAPdP9kMrOV1LtLEuXgoXZGifVNnPQhtT7fQ7kDmbM-HDG4MquZy89CIRy2q22xIclePOAoe0Ifz6q7-NG3I9CzKOAa_Vx6Oy5ZYBYphfV1n46gp4OC0Cb_w-wFLfRDuDPJZvcS5ed2HxdyZrU_GeD4WSN5IQpEn_45CZifBzmv9-jweEUD2or3sp1DReORLZG2CvBqtixC0p3gIeGnY4HROduafmDfyI0gcv7pDM-fcreMCBG-7uqUPkk9rqhCPw9n6fhWvNMSGrtW9tx6hAPNxjKJ2AsyTh7cJyR0teVpijhXZz0dGJOtYY1-nlR7_BnJH2lC9tLiIJcVl1JKfGRu18MV1bHs7y25Wp1HxVDUXllShXa7_oD7ljnE3stmpO5GPMbxvWC_RKO_bu_e2mAgJ3yiPImFpLVYZZgBqClctciZMQeV1lZTAy-7Xlzgdx-IvFc9VuigKw6hfk4on98BxMUENeh20KIgVv8cMr4ZjAGV3MjnFnHWw
fi

# Run FHIR conversion on seed data
if [ "$CONVERT_SEED_DATA" = true ]; then
echo "Running seed data FHIR conversion..."
docker compose -f ./docker-compose.yml --profile "*" down -v
npm run clear-local
npm run convert-seed-data:build
else
echo "Skipping seed data FHIR conversion..."
fi

# Run ecr viewer
npx @dotenvx/dotenvx run -f .env.local -- sh -c 'docker compose -f ./docker-compose.yml --profile ${SOURCE} --profile ${METADATA_DATABASE_TYPE} --profile ecr-viewer up -d'
npm run local-docker

# Wait for eCR Viewer to be available
URL="http://localhost:3000/ecr-viewer"
while ! curl -s -o /dev/null -w "%{http_code}" "$URL" | grep -q "200"; do
echo "Waiting for $URL to be available..."
sleep 5
Expand Down
62 changes: 32 additions & 30 deletions containers/ecr-viewer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ services:
ports:
- "3000:3000"
environment:
- APP_ENV=${APP_ENV:-test}
- METADATA_DATABASE_TYPE=${METADATA_DATABASE_TYPE:-postgres}
- SOURCE=${SOURCE:-postgres}
- CONFIG_NAME=${CONFIG_NAME:-AWS_SQLSERVER_NON_INTEGRATED}
- NBS_PUB_KEY=${NBS_PUB_KEY}
# POSTGRES
- DATABASE_URL=postgres://postgres:pw@postgres:5432/ecr_viewer_db
# AWS
- AWS_CUSTOM_ENDPOINT=http://aws-storage:4566
- AWS_REGION=${AWS_REGION:-us-east-1}
- ECR_BUCKET_NAME=${ECR_BUCKET_NAME:-ecr-viewer-files}
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-123}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-xyz}
# Azure
- AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azure-storage:10000/devstoreaccount1;
- AZURE_CONTAINER_NAME=${AZURE_CONTAINER_NAME:-ecr-viewer-files}
- NEXT_PUBLIC_NON_INTEGRATED_VIEWER=${NEXT_PUBLIC_NON_INTEGRATED_VIEWER:-true}
- METADATA_DATABASE_SCHEMA=${METADATA_DATABASE_SCHEMA:-core}
- SQL_SERVER_USER=${SQL_SERVER_USER}
- SQL_SERVER_PASSWORD=${SQL_SERVER_PASSWORD}
# SQL Server
- SQL_SERVER_USER=${SQL_SERVER_USER:-sa}
- SQL_SERVER_PASSWORD=${SQL_SERVER_PASSWORD:-Password1!}
- SQL_SERVER_HOST=${SQL_SERVER_HOST:-sqlserver}
profiles:
- ecr-viewer
Expand All @@ -47,13 +48,14 @@ services:
timeout: 5s
retries: 20
profiles:
- postgres
- AWS_PG_NON_INTEGRATED
- AZURE_PG_NON_INTEGRATED

sqlserver:
image: mcr.microsoft.com/mssql/server:2022-latest
environment:
- ACCEPT_EULA=Y
- MSSQL_SA_PASSWORD=${SQL_SERVER_PASSWORD}
- MSSQL_SA_PASSWORD=${SQL_SERVER_PASSWORD:-Password1!}
ports:
- "1433:1433"
volumes:
Expand All @@ -69,7 +71,8 @@ services:
interval: 20s
retries: 5
profiles:
- sqlserver
- AWS_SQLSERVER_NON_INTEGRATED
- AZURE_SQLSERVER_NON_INTEGRATED

aws-storage:
image: gresau/localstack-persist:3
Expand All @@ -79,39 +82,38 @@ services:
- aws-data:/persisted-data
- ./seed-scripts/aws:/etc/localstack/init/ready.d
profiles:
- s3
- AWS_INTEGRATED
- AWS_PG_NON_INTEGRATED
- AWS_SQLSERVER_NON_INTEGRATED

azure-storage:
image: mcr.microsoft.com/azure-storage/azurite
build:
context: ./seed-scripts
dockerfile: azurite.Dockerfile
hostname: azurite
restart: always
command: "azurite --blobHost 0.0.0.0 --blobPort 10000 -l data --debug /data/debug.log"
command:
- /bin/sh
- -c
- |
azurite --blobHost 0.0.0.0 --blobPort 10000 -l data --debug /data/debug.log &
sleep 5
az storage container create --name ecr-viewer-files
tail -f /dev/null
volumes:
- azure-data:/opt/azurite/data
environment:
AZURE_STORAGE_CONNECTION_STRING: DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://localhost:10000/devstoreaccount1;
healthcheck:
test: nc 127.0.0.1 10000 -z
interval: 1s
retries: 30
ports:
- "10000:10000"
profiles:
- azure

azure-storage-init:
image: mcr.microsoft.com/azure-cli:latest
command:
- /bin/sh
- -c
- |
az storage container create --name ecr-viewer-files
depends_on:
azure-storage:
condition: service_healthy
environment:
# https://github.com/Azure/Azurite/blob/main/README.md#usage-with-azure-storage-sdks-or-tools
AZURE_STORAGE_CONNECTION_STRING: DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azure-storage:10000/devstoreaccount1;
profiles:
- azure
- AZURE_INTEGRATED
- AZURE_PG_NON_INTEGRATED
- AZURE_SQLSERVER_NON_INTEGRATED

volumes:
db:
Expand Down
10 changes: 9 additions & 1 deletion containers/ecr-viewer/environment.d.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
/* eslint-disable unused-imports/no-unused-vars */
namespace NodeJS {
interface ProcessEnv {
APP_ENV: "test" | "dev" | "middleware" | "prod";
AWS_ACCESS_KEY_ID: string;
AWS_CUSTOM_ENDPOINT: string;
AWS_REGION: string;
AWS_SECRET_ACCESS_KEY: string;
AZURE_CONTAINER_NAME: string;
AZURE_STORAGE_CONNECTION_STRING: string;
BASE_PATH: string;
CONFIG_NAME:
| "AWS_INTEGRATED"
| "AWS_PG_NON_INTEGRATED"
| "AWS_SQLSERVER_NON_INTEGRATED"
| "AZURE_INTEGRATED"
| "AZURE_PG_NON_INTEGRATED"
| "AZURE_SQLSERVER_NON_INTEGRATED";
DATABASE_TYPE: string;
DATABASE_URL: string;
ECR_BUCKET_NAME: string;
GITHUB_ID: string;
GITHUB_SECRET: string;
METADATA_DATABASE_SCHEMA?: "core" | "extended";
METADATA_DATABASE_TYPE?: "postgres" | "sqlserver";
NBS_AUTH: "true" | "false";
NBS_PUB_KEY: string;
NEXT_PUBLIC_NON_INTEGRATED_VIEWER: "true" | "false";
NEXT_RUNTIME: string;
NEXTAUTH_SECRET: string;
NON_INTEGRATED_VIEWER: "true" | "false";
SOURCE: "s3" | "azure" | "postgres";
SQL_SERVER_HOST: string;
SQL_SERVER_PASSWORD: string;
Expand Down
1 change: 1 addition & 0 deletions containers/ecr-viewer/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const createJestConfig = nextJest({
const customJestConfig = {
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
testEnvironment: "jest-environment-jsdom",
modulePathIgnorePatterns: ["<rootDir>/.next"],
moduleNameMapper: {
"^mssql$": "<rootDir>/src/app/tests/__mocks__/mssql.js",
"^tedious$": "<rootDir>/src/app/tests/__mocks__/mssql.js",
Expand Down
Loading

0 comments on commit 61ac6d5

Please sign in to comment.