πŸ“—
UpGrade Platform - Documentation
6.0
6.0
  • UpGrade Overview
  • Creating an Experiment
    • Unit of Assignment
    • Simple Experiment
    • Factorial Experiment
    • Inclusion and Exclusion
    • Schedule and Post-Rule
    • Exporting Experiment Data and Design
  • Creating a Feature Flag
  • How UpGrade Works
  • Researcher Guide
  • Developer Guide
    • ⚑Quick Start: Running UpGrade Locally with Docker
    • ⚑Quick Start: Running locally w/o Docker
    • UpGrade + AdapComp (Mooclet) in Docker
    • πŸšΆβ€β™€οΈWalkthroughs
      • Your Application and UpGrade
      • Example 1: A Quiz Web App
      • Example 2: An Online Math Game
    • πŸ“šReference
      • API
      • Client Libraries
        • TypeScript / JS
          • Class: UpgradeClient
          • Class: Assignment
          • SDK Interfaces
            • Interface: IMetric
            • Interface: IExperimentUser
            • Interface: IExperimentUserAliases
            • Interface: ILog
            • Interface: IMarkExperimentPoint
            • Interface: IMetric
            • Interface: IRequestOptions
            • Interface: IResponse
            • Interface: IUser
            • Interface: IUserGroup
      • Environment Variables
        • Frontend Environment
        • Backend Environment
      • Context Metadata
      • Metrics
      • Setting up Google-Auth
      • API Authorization
      • Data Architecture
    • πŸ‘¨β€πŸ’»Contributing Code
      • Branching Workflow (Git-Flow)
      • Pull Request Expectations
    • πŸ˜…Troubleshooting
      • Relation β€˜experiment_condition’ already exists
      • User not found. Authorization error
      • Token is not present in the request header
      • nodemon exits without explanation
      • Unable to find New Relic module configuration
      • No email received for export data
      • Opening a new tab in UpGrade prompts for re-authorization
      • Error: Cannot find module 'upgrade_types' (or a type from 'upgrade_types' does not exist)
  • Glossary
Powered by GitBook
On this page
  1. Developer Guide
  2. Reference
  3. Environment Variables

Backend Environment

Details for Backend Configuration

PreviousFrontend EnvironmentNextContext Metadata

Last updated 2 months ago

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

.env will need to be created for running backend locally (if not using ). 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

Application Level

Variable
Description
Allowed Values
Example

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

CORS_WHITELIST

domains to allow to bypass cross-domain restrictions

array of strings

localhost

Logging

Variable
Description
Allowed Values
Example

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

Variable
Description
Allowed Values
Example

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

Variable
Description
Allowed Values
Example

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

Variable
Description
Allowed Values
Example

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

Variable
Description
Allowed Values
Example

GOOGLE_CLIENT_ID

Google Client Id credential provided from Google Cloud Console

string or comman separated strings for multiple

<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

GOOGLE_SERVICE_ACCOUNT_ID

Google Service Account key

string or comman separated strings for multiple

xxxxxxxxxx

AWS Configs

Variable
Description
Allowed Values
Example

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

ALLOW_SERVICE_ACCOUNT_TOKEN_SERVICE

Allow token granting endpoint `/token`

boolean

false

GOOGLE_SERVICE_ACCOUNT_CREDENTIAL_FILE

Path to service credential on server if allowed above

string path

/path/to/credential.json

Email Config

Variable
Description
Allowed Values
Example

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

Variable
Description
Allowed Values
Example

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

Variable
Description
Allowed Values
Example

CONTEXT_METADATA

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

METRICS

Variable
Description
Allowed Values
Example

METRICS

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

πŸ“š
.env.example
local Docker workflow
.env.local.docker
Please see CONTEXT_METADATA article for full details
Please see CONTEXT_METADATA article for full details
Please see METRICS article for full details
Please see METRICS article for full details