Environment Variables

Details for Backend Configuration

Assume most variables are required unless noted otherwise; see sample .env.example for sample usage in order to create a local .env file.

.env will need to be created for running backend locally (if not using local Docker workflow). Note that this will not be included in build or git history. You will need to configure EV in your host environment. If using Docker workflow for local development, you will want to make sure to set your local env vars in .env.local.docker

Application Level

VariableDescriptionAllowed ValuesExample

APP_NAME

Name for the application

string

"A/B Testing"

APP_SCHEMA

Protocol for local server

"http" or "https"

"http"

APP_PORT

Port number to the backend application

string

"3030"

APP_HOST

Domain to be used in Upgrade local codebase

string

"localhost"

APP_ROUTE_PREFIX

API route prefix

"/" + url safe string

"/api"

APP_BANNER

console log the basic info of the application as a banner log

boolean

TRUE

APP_DEMO

deploy as demo-supporting backend. Additionally, gives access to clear DB via "/clearDB"

boolean (default: false)

FALSE

CACHING_ENABLED

Enable cached query calls (current applies to GET /segments queries)

boolean (default: FALSE)

TRUE

Logging

VariableDescriptionAllowed ValuesExample

LOG_LEVEL

Log level for Winston logger

"error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly"

"debug"

LOG_OUTPUT

log output

"dev" or empty

"dev"

TYPEORM + POSTGRES CONFIG

VariableDescriptionAllowed ValuesExample

TYPEORM_CONNECTION

Name for TypeORM connection to DB

string

"postgres"

TYPEORM_HOST (RDS_HOSTNAME)

TypeORM connection domain to be used in Upgrade local codebase Replace with RDS_HOSTNAME if deployed in AWS

string

"localhost"

TYPEORM_HOSTNAME_REPLICAS (RDS_HOSTNAME_REPLICAS)

TypeORM connection domains for any read-replica DB to be used in Upgrade local codebase Replace with RDS_HOSTNAME_REPLICAS if deployed in AWS

array of strings

[ "localhost1", "localhost2", "localhost3"]

TYPEORM_PORT (RDS_PORT)

Port to be used for connection

string

"5432"

TYPEORM_USERNAME (RDS_USERNAME)

Connection username

string

"postgres"

TYPEORM_PASSWORD (RDS_PASSWORD)

Connection password

string

"postgres"

TYPEORM_DATABASE (RDS_DB_NAME)

Name of database driver

string

"postgres"

TYPEORM_SYNCHRONIZE

Whether TypeORM models will synchronize with DB at startup

boolean

FALSE

TYPEORM_LOGGING

Log level for db queries

"query" | "schema" | "error" | "warn" | "info" | "log" | "migration"

"error"

TYPEORM_MAX_QUERY_EXECUTION_TIME

Number of milliseconds before TypeORM will log a "slow query" message. (Note: this does not timeout a query)

string

1000

TYPEORM_MAX_CONNECTION_POOL_SIZE

Maximum number of db connections to postgres

string

20 (defaults to 10)

PATH STRUCTURE FOR TYPEORM

VariableDescriptionAllowed ValuesExample

TYPEORM_MIGRATIONS

Path for all migration files to apply

string

src/database/migrations/**/*.ts

TYPEORM_MIGRATIONS_DIR

Path for migration root directory

string

src/database/migrations

TYPEORM_ENTITIES

Path for all entity models.

string

src/api/models/**/*.ts

TYPEORM_ENTITIES_DIR

Path for entities root directory

string

src/api/models

CONTROLLERS

Path for controllers

string

src/api/controllers/**/*Controller.ts

MIDDLEWARES

Path for middlewares

string

src/api/middlewares/**/*Middleware.ts

INTERCEPTORS

Path for interceptors.

string

src/api/interceptors/**/*Interceptor.ts

TYPEORM_SEED

Path for seeding data files

string

src/database/seeds/**/*.seed.ts

TYPEORM_FACTORY

Path for factories

string

src/database/factories/**/*.factory.ts

SWAGGER

VariableDescriptionAllowed ValuesExample

SWAGGER_ENABLED

Enables generation of swagger API docs output. (If not needed, build is faster when FALSE)

boolean

FALSE

SWAGGER_ROUTE

URL endpoint to access swagger docs (host + SWAGGER_ROUTE)

string

/swagger

SWAGGER_API

Code path for swagger API source

string

src/api/controllers/*.ts

Authorization Config

VariableDescriptionAllowed ValuesExample

GOOGLE_CLIENT_ID

Google Client Id credential provided from Google Cloud Console

string

<id>.apps.googleusercontent.com

DOMAIN_NAME

Limit Google-auth JWT credential token to be granted only user logins from a specific email domain (blank will allow all domains)

string

yourDomain.com

AUTH_CHECK

Enables Google-Auth credential Bearer token validation on public API requests

string

FALSE

AWS Configs

VariableDescriptionAllowed ValuesExample

SCHEDULER_STEP_FUNCTION

The arn value of the Schedular step function deployed in aws

string

arn:aws:states:us-east-1:781188149671:stateMachine:development-upgrade-experiment-schedular

AWS_REGION

AWS region for backend and frontend resource deployments

Valid AWS Region string

"us-east-1"

HOST_URL

AWS deployed backend endpoint url

string

"http://development-upgrade-experiment-app.eba-gp6psjut.us-east-1.elasticbeanstalk.com/api"

TOKEN_SECRET_KEY

Secret key shared with Scheduler Lambda function to decode JWT authorization token in request

string

carnegielearning

Email Config

VariableDescriptionAllowed ValuesExample

EMAIL_FROM

Addess that email will be sent from

string

dev@playpowerlabs.com

EMAIL_EXPIRE_AFTER_SECONDS

Milliseconds to retain availability of email

string

36000

EMAIL_BUCKET

S3 email bucket name deployed on aws

string

"upgrade-csv-upload"

Initialization

VariableDescriptionAllowed ValuesExample

ADMIN_USERS

Email addresses that will be inserted as users with "admin" or other role automatically in this environment

string list of email addresses, with ":" followed be "admin" or other role. delimited by "/\"

"user1@email.com:admin/\user2@email.com:admin/\user3@email.com:creator"

CLIENT_API_SECRET

Secret value shared with Client Library function to verify JWT authorization token payload in request

string

"api-token-secret"

CLIENT_API_KEY

Secret key shared with Client Library function to decode JWT authorization token in request

string

"api-token-key"

CONTEXT_METADATA

VariableDescriptionAllowed ValuesExample

CONTEXT_METADATA

Describes valid references to technical values from client platforms that will be connected to UpGrade experiments.

METRICS

VariableDescriptionAllowed ValuesExample

METRICS

Describes valid references to outcomes data from client platforms that will be connected to UpGrade experiments.

Last updated