Skip to main content

Environment Variables

The first environment variable to set is RAILS_ENV, selecting one of 3 possible modes to run DES in:

  • development: suitable for local development or manual testing.
  • test: for running unit-tests.
  • production: suitable for any type of deployment open to the (public) internet, be it staging or production.

Each mode above defines a set of default configurations, that can be overridden by setting environment variables.

Server settings

Environment Variabledevelopment defaultproduction defaultdescription
CDN_HOST(request.host)(request.host)Sets the host for the assets. Useful if a CDN is used.
DATABASE_URLpostgres://
postgres:postgres
@localhost:5432
/dreams_enterprise_development
requiredURL with credentials for a Postgres 11-compatible database.
DEVISE_SECRET_KEY(base64 string)required The secret key used by DEPo's authentication system to generate random tokens. Changing this key will invalidate all DEPo users' existing confirmation, reset password and unlock tokens.
FORCE_SSLfalsetrueForce browsers to redirect HTTP to HTTPS, enable HSTS, and mark cookies as "secure".
LOG_LEVELdebuginfoLog severity threshold.
PORT30003000The web server will listen for connections on this port.
RAILS_MAX_THREADS55The maximum number of threads available in a thread pool to serve requests concurrently.
RAILS_MIN_THREADS(RAILS_MAX_THREADS)(RAILS_MAX_THREADS)The minimum number of threads available in a thread pool to serve requests concurrently.
ROOT_DOMAINdreams.testrequiredRequired for subdomain-based routing.
SECRET_KEY_BASE(random)requiredInput secret to the application's key generator, used e.g. to sign and encrypt cookies.
SINGLE_TENANT_MODE--Set to true to disable partner discovery based on the subdomain but instead just force fetch the first partner available in the database. This should be only used if there is only one partner in the database.
ACTIVE_RECORD_PRIMARY_KEY-requiredThis is required to enable application level encryption for some fo the fields in the database. See Active record encryption guide
ACTIVE_RECORD_DETERMINISTIC_KEY-requiredThis is required to enable application level encryption for some fo the fields in the database. See Active record encryption guide
ACTIVE_RECORD_KEY_DERIVATION_SALT-requiredThis is required to enable application level encryption for some fo the fields in the database. See Active record encryption guide
ACTIVE_SERVICESwebapp, depo, api, externalwebapp, depo, apiThis lets you control what services are enabled. It's useful if you run several docker containers each accepting requests only for particular module. So you can have e.g. a docker container running and having "webapp" enabled (and other services disabled) that is in a "public" zone of your infrastructure or accepts requests from public internet. You can have "depo" container running in another zone the only has "depo" related endpoints open. This only controlls what endpoints are active and has no control over what can be done through e.g. rails console. Mind that currently the asset paths and active storage paths are exempt from this and will work regardless of what is set.
ACTIVE_STORAGE_RESOLVERrails_storage_redirectrails_storage_redirectDetermines how (DEPo-) uploaded content and customer-uploaded images are served. With rails_storage_redirect DES redirects to the storage location (e.g. using presigned S3 URLs), with rails_storage_proxy DES serves the content by acting as a proxy.

Content Uploads from DEPo

DES supports two types of storage for persistence of uploaded images: file system based and S3 based. The environment variable ACTIVE_STORAGE_SERVICE governs which approach is used.

File system based storage

To persist files using the file system approach (e.g. using a mounted volume) set the env var ACTIVE_STORAGE_SERVICE to local.

S3 based storage

To persist files using an S3-compatible storage service there are two possible values for ACTIVE_STORAGE_SERVICE: amazon and s3_compatible.

  • When using AWS S3 as the storage service, use amazon
  • When using a S3-compatible service other than AWS S3, use s3_compatible

See below table for a more thorough description of how to configure DES with S3-compatible storage.

Environment Variabledevelopment defaultproduction defaultdescription
ACTIVE_STORAGE_SERVICElocalamazonPossible values are local, amazon & s3_compatible. local means file system based, amazon is for AWS S3 storage and s3_compatible is for other S3-compatible storage services.
AWS_REGION--required if ACTIVE_STORAGE_SERVICE is amazon
AWS_ACCESS_KEY_ID--required if ACTIVE_STORAGE_SERVICE is amazon
AWS_SECRET_ACCESS_KEY--required if ACTIVE_STORAGE_SERVICE is amazon
AWS_ACTIVE_STORAGE_FILES_BUCKET_NAMEactive-storage-filesactive-storage-filesThe bucket name for file uploads when ACTIVE_STORAGE_SERVICE is set to amazon
S3_COMPATIBLE_ACTIVE_STORAGE_ENDPOINT--The endpoint to the S3 compatible service. This should be a valid HTTP(S) URI. Only required when ACTIVE_STORAGE_SERVICE is set to s3_compatible
S3_COMPATIBLE_ACTIVE_STORAGE_FILES_BUCKET_NAME--The bucket name for file uploads when ACTIVE_STORAGE_SERVICE is set to s3_compatible
S3_COMPATIBLE_ACTIVE_STORAGE_ACCESS_KEY_ID--The access key id to use when authenticating with S3_COMPATIBLE_ACTIVE_STORAGE_ENDPOINT
S3_COMPATIBLE_ACTIVE_STORAGE_SECRET_ACCESS_KEY--The secret access key to use when authenticating with S3_COMPATIBLE_ACTIVE_STORAGE_ENDPOINT
S3_COMPATIBLE_ACTIVE_STORAGE_FORCE_PATH_STYLEtruetruetrue or false, depending on the s3-compatible service used and its configuration
S3_COMPATIBLE_ACTIVE_STORAGE_REGIONeu-central-1eu-central-1Value dependent on S3-compatible service requirements.

Customer image uploads

You also have the possibility to configure a separate storage for customer uploaded images. The environment variable ACTIVE_STORAGE_CUSTOMER_UPLOADED_IMAGES_SERVICE governs which approach is used.

File system based storage

To persist customer uploaded images using the file system approach (e.g. using a mounted volume) set the env var ACTIVE_STORAGE_CUSTOMER_UPLOADED_IMAGES_SERVICE to local.

S3 based storage

To persist customer uploaded images using an S3-compatible storage service there are two possible values for ACTIVE_STORAGE_CUSTOMER_UPLOADED_IMAGES_SERVICE: customer_uploaded_images_service and s3_compatible_customer_uploaded_images.

  • When using AWS S3 as the storage service, use customer_uploaded_images_service
  • When using a S3-compatible service other than AWS S3, use s3_compatible_customer_uploaded_images

See below table for a more thorough description of how to configure DES with S3-compatible storage for customer uploaded images.

Environment Variabledevelopment defaultproduction defaultdescription
ACTIVE_STORAGE_CUSTOMER_UPLOADED_IMAGES_SERVICElocalcustomer_uploaded_images_servicePossible values are local, customer_uploaded_images_service & s3_compatible_customer_uploaded_images
AWS_CUSTOMER_UPLOADED_IMAGE_BUCKET_NAMEcustomer-uploaded-imagescustomer-uploaded-imagesThe bucket name for customer image uploads when ACTIVE_STORAGE_CUSTOMER_UPLOADED_IMAGES_SERVICE is set to customer_uploaded_images_service.
S3_COMPATIBLE_CUSTOMER_UPLOADED_IMAGES_ENDPOINT--The endpoint to the S3 compatible service. This should be a valid HTTP(S) URI. Only required when ACTIVE_STORAGE_CUSTOMER_UPLOADED_IMAGES_SERVICE is set to s3_compatible_customer_uploaded_images.
S3_COMPATIBLE_CUSTOMER_UPLOADED_IMAGES_BUCKET_NAME--The bucket name for customer image uploads when ACTIVE_STORAGE_CUSTOMER_UPLOADED_IMAGES_SERVICE is set to s3_compatible_customer_uploaded_images.
S3_COMPATIBLE_CUSTOMER_UPLOADED_IMAGES_ACCESS_KEY_ID--The access key id to use when authenticating with S3_COMPATIBLE_CUSTOMER_UPLOADED_IMAGES_ENDPOINT
S3_COMPATIBLE_CUSTOMER_UPLOADED_IMAGES_SECRET_ACCESS_KEY--The secret access key to use when authenticating with S3_COMPATIBLE_CUSTOMER_UPLOADED_IMAGES_ENDPOINT
S3_COMPATIBLE_CUSTOMER_UPLOADED_IMAGES_FORCE_PATH_STYLEtruetruetrue or false, depending on the s3-compatible service used and its configuration
S3_COMPATIBLE_CUSTOMER_UPLOADED_IMAGES_REGIONeu-central-1eu-central-1Value dependent on s3-compatible service requirements.

External events

To be able to use savehacks such as Save League, you will need to set the following environment variables to activate to recurringly fetch external events from our external events API:

Environment Variabledevelopment defaultproduction defaultdescription
EXTERNAL_EVENTS_HOST--URL to fetch external events from, provided by Doconomy
EXTERNAL_EVENTS_PROXY--Optional URL of a proxy to use to access EXTERNAL_EVENTS_HOST
EXTERNAL_EVENTS_API_KEY--API key to use to authenticate with external events API, provided by Doconomy
EXTERNAL_EVENTS_TOKEN--API token to use to authenticate with external events API, provided by Doconomy

Mail settings for MetaDEPo and DEPo

Environment Variabledevelopment defaultproduction defaultdescription
SMTP_USERNAME(not used)-If your mail server requires authentication, set the username in this setting.
SMTP_PASSWORD(not used)-If your mail server requires authentication, set the password in this setting.
SMTP_DOMAIN(not used)-Used for HELO domain and mail sender will be noreply@<SMTP_DOMAIN>.
SMTP_ADDRESS(not used)localhostAllows you to use a remote mail server.
SMTP_PORT(not used)25Remote mail server port.