Environment Variables(EV)

Environment variables you need to set for running Upgrade

We have categorized the environment variables into 9 categories as per their use cases:

  • Application level environment variables:

    • APP_NAME: This EV is set to define a name to the application. For e.g.: APP_NAME = A/B Testing Backend

    • APP_SCHEMA: This EV is set to define the protocol(http/https) to be used in Upgrade local codebase. For e.g.: APP_SCHEMA=http

    • APP_PORT: This EV is set to define a port number to the backend application. For e.g.: APP_PORT = 3030

    • APP_HOST: This EV is set to define the domain to be used in Upgrade local codebase. For e.g.: APP_HOST=localhost

    • APP_ROUTE_PREFIX: This EV is set to define a route prefix to the backend url. For e.g.: APP_ROUTE_PREFIX = /api

    • APP_BANNER: This EV is set to define if you want to console log the basic info of the application as a banner log. For e.g.: APP_BANNER=true

    • APP_DEMO: This EV is set to define if you want to deploy the application as a demo testing application. This will give you an additional access to clear the DB to perform faster testing during developments. For e.g.: APP_DEMO=true

  • Logging environment variables:

    • LOG_LEVEL: This EV is set to define a logging level for winston logger. It can have various values like (info, error, debug, warn). For e.g.: LOG_LEVEL = debug

    • LOG_OUTPUT: This EV is set to define if you want logging output. Set to 'dev' for development environment else blank. For e.g.: LOG_OUTPUT = dev

  • Postgres DB and TYPEORM environment variables:

    • TYPEORM_CONNECTION: This EV is set to define a typeorm connection name. For postgres db it is to be set to 'postgres' For e.g.: TYPEORM_CONNECTION = postgres

    • TYPEORM_HOST: This EV is set to define the typeorm connection domain to be used in Upgrade local codebase. This would be replaced by RDS_HOSTNAME variable when deployed on AWS. For e.g.: TYPEORM_HOST=localhost

    • TYPEORM_HOSTNAME_REPLICAS: This EV is set to define the typeorm connection domains for the read-replicas to be used in Upgrade local codebase. This would be replaced by RDS_HOSTNAME_REPLICAS variable when deployed on AWS. For e.g.: TYPEORM_HOSTNAME_REPLICAS=[ "localhost1", "localhost2", "localhost3" ]

    • TYPEORM_PORT: This EV is set to define a port number of typeorm connection. For e.g.: TYPEORM_PORT = 5432

    • TYPEORM_USERNAME: This EV is set to define the database username required for the typeorm connection. For e.g.: TYPEORM_USERNAME=<your db username>

    • TYPEORM_PASSWORD: This EV is set to define the database password required for the typeorm connection. For e.g.: TYPEORM_PASSWORD = <your db password> or blank

    • TYPEORM_DATABASE: This EV is set to define the database name required for typeorm connection. For e.g.: TYPEORM_DATABASE=postgres

    • TYPEORM_SYNCHRONIZE: This EV is set to true if you want to instantly update and syncronize changes to database models from Upgrade code. For e.g.: TYPEORM_SYNCHRONIZE=true

    • TYPEORM_LOGGING: This EV is set to define the logging format for the typeorm connection. This can take any values from ('query' | 'schema' | 'error' | 'warn' | 'info' | 'log' | 'migration')For e.g.: TYPEORM_LOGGING = error

    • TYPEORM_MAX_QUERY_EXECUTION_TIME: This EV is set to define the maximum time a query should take else we filter the queries that are slow and log them in console. Here we keep 1000 ms as standard value. For e.g.: TYPEORM_MAX_QUERY_EXECUTION_TIME=1000

  • PATH STRUCTURE environment variables:

    • TYPEORM_MIGRATIONS: This EV is set to define the path for all migration files to apply. For e.g.: TYPEORM_MIGRATIONS = src/database/migrations/**/*.ts

    • TYPEORM_MIGRATIONS_DIR: This EV is set to define the path for migration root directory. For e.g.: TYPEORM_MIGRATIONS_DIR=src/database/migrations

    • TYPEORM_ENTITIES: This EV is set to define the path for all entity models. For e.g.: TYPEORM_ENTITIES=src/api/models/**/*.ts

    • TYPEORM_ENTITIES_DIR: This EV is set to define the path for entities root directory. For e.g.: TYPEORM_ENTITIES_DIR = src/api/models

    • CONTROLLERS: This EV is set to define the path for controllers. For e.g.: CONTROLLERS=src/api/controllers/**/*Controller.ts

    • MIDDLEWARES: This EV is set to define the path for middlewares. For e.g.: MIDDLEWARES = src/api/middlewares/**/*Middleware.ts

    • INTERCEPTORS: This EV is set to definethe path for interceptors. For e.g.: INTERCEPTORS=src/api/interceptors/**/*Interceptor.ts

    • TYPEORM_SEED: This EV is set to define the path for seeding data files . For e.g.: TYPEORM_SEED=src/database/seeds/**/*.seed.ts

    • TYPEORM_FACTORY: This EV is set to define the path for factories. For e.g.: TYPEORM_FACTORY = src/database/factories/**/*.factory.ts

  • SWAGGER environment variables:

    • SWAGGER_ENABLED: This EV is set if you want to see swagger output to check and test api calls. Turning it off with 'false' will build the backend faster, so avoid when not requied. For e.g.: SWAGGER_ENABLED=false

    • SWAGGER_ROUTE: This EV is set to define the route to see swagger output. For e.g.: SWAGGER_ROUTE=/swagger

    • SWAGGER_API: This EV is set as the path to the controller files to list all api's from those controller files. For e.g.: SWAGGER_API = **/controllers/*.ts

  • Status Monitor environment variables (TODO):

    • MONITOR_ENABLED: This EV is set to define . For e.g.: MONITOR_ENABLED=true

    • MONITOR_ROUTE: This EV is set to define api route to monitor outputs. For e.g.: MONITOR_ROUTE=/monitor

    • MONITOR_USERNAME: This EV is set to define the monitor username. For e.g.: MONITOR_USERNAME = admin

    • MONITOR_PASSWORD: This EV is set to define the monitor password. For e.g.: MONITOR_PASSWORD=1234

  • Google Client Id environment variables:

    • GOOGLE_CLIENT_ID: This EV is set to define the google cloud platform project's client id for google login. For e.g.: GOOGLE_CLIENT_ID=135765367152-pq4jhd3gra10jda9l6bpnmu9gqt48tup.apps.googleusercontent.com

    • DOMAIN_NAME: This EV is set to define the allowed domain for login. For e.g.: DOMAIN_NAME = <yourdomain> or <gmail> or blank for allowing all domains.

    • AUTH_CHECK: This EV is set to have an explicit authentication check for login bearer token, else for 'false' it ignores this. For e.g.: AUTH_CHECK=false

  • AWS environment variables:

    • SCHEDULER_STEP_FUNCTION: This EV is set to define the arn value of the Schedular step function deployed in aws. For e.g.: SCHEDULER_STEP_FUNCTION=arn:aws:states:us-east-1:781188149671:stateMachine:development-upgrade-experiment-schedular

    • AWS_REGION: This EV is set to define the aws region used for backend and frontend deployments. For e.g.: AWS_REGION = us-east-1

    • HOST_URL: This EV is set to define deployed backend endpoint url. For e.g.: HOST_URL=http://development-upgrade-experiment-app.eba-gp6psjut.us-east-1.elasticbeanstalk.com/api

    • TOKEN_SECRET_KEY: This EV is set to define the token secret key. For e.g.: TOKEN_SECRET_KEY=carnegielearning

  • Email environment variables:

    • EMAIL_FROM: This EV is set to define the email id from which the users would recieve email updates. For e.g.: EMAIL_FROM = "dev@playpowerlabs.com"

    • EMAIL_EXPIRE_AFTER_SECONDS: This EV is set to define expiry time in ms for email sending feature. For e.g.: EMAIL_EXPIRE_AFTER_SECONDS=36000

    • EMAIL_BUCKET: This EV is set to define s3 bucket name on aws. For e.g.: EMAIL_BUCKET="upgrade-csv-upload"

  • Initialization environment variables:

    • ADMIN_USERS: This EV is set to define if you want to deploy the application as a demo testing application. This will give you an additional access to clear the DB to perform faster testing during developments. For e.g.: ADMIN_USERS=dev1@playpowerlabs.com:admin/\dev2@playpowerlabs.com:admin

    • CLIENT_API_SECRET: This EV is to set the client api secret key. For e.g.: CLIENT_API_SECRET = secret-key

    • CLIENT_API_KEY: This EV is to set the client api key. For e.g.: CLIENT_API_KEY=api-key

    • CONTEXT_METADATA: This EV is set to define the context related metadata. Here you can define Experiment id's, points, group-types and conditions for each context. This will show up to user as auto suggestion while creating experiments. For e.g.: CONTEXT_METADATA={"add":{"EXP_IDS":["add-id1","add-id2"],"EXP_POINTS":["add-point1","add-point2"],"GROUP_TYPES":["add-group1","add-group2"],"CONDITIONS":["add-con1","add-con2","add-con3"]},"sub":{"EXP_IDS":["sub-id1","sub-id2"],"EXP_POINTS":["sub-point1","sub-point2"],"GROUP_TYPES":["sub-group1","sub-group2"],"CONDITIONS":["sub-con1","sub-con2","sub-con3"]},"mul":{"EXP_IDS":["mul-id1","mul-id2"],"EXP_POINTS":["mul-point1","mul-point2"],"GROUP_TYPES":["mul-group1","mul-group2"],"CONDITIONS":["mul-con1","mul-con2","mul-con3"]},"div":{"EXP_IDS":["div-id1","div-id2"],"EXP_POINTS":["div-point1","div-point2"],"GROUP_TYPES":["div-group1","div-group2"],"CONDITIONS":["div-con1","div-con2","div-con3"]}}

    • METRICS: This EV is set to define the single and group metrics for the experiments. For e.g.: METRICS=[{"metric": "totalTimeSeconds","datatype": "continuous"}, { "groupClass": "masteryWorkspace", "allowedKeys": [ "calculating_area_various_figures", "Compare_functions_diff_reps_quadratic" ], "attributes": [{ "metric": "timeSeconds", "datatype": "continuous"}]}]

Last updated