Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Latest commit

 

History

History
930 lines (705 loc) · 21.6 KB

Environment-Variables.md

File metadata and controls

930 lines (705 loc) · 21.6 KB

👈 Return to Overview

Environment Variables

One App can be configured via Environment Variables:

📖 Table of Contents

By Topic

Alphabetical Contents

⚠️ = Required

DOTENV_CONFIG_PATH

One App supports the usage of Dotenv. This environment variable allows you to specify the path to the .env file that should be loaded. These values are loaded before the start of the One App server. See the documentation for Dotenv for advanced usage. Dotenv will look for .env by default if this is not set.

Runs In

  • ✅ Production
  • ✅ Development

Shape

DOTENV_CONFIG_PATH=String

Example

DOTENV_CONFIG_PATH=.env

HOLOCRON_MODULE_MAP_URL

⚠️ Required In Production

Runs In

  • ✅ Production
  • ✅ Development

URL where the Module Map is hosted.

Defaults to http://localhost:3001/static/module-map.json if NODE_ENV is set to development so that One App Dev CDN can be leveraged for local development.

Shape

HOLOCRON_MODULE_MAP_URL=String

Example

HOLOCRON_MODULE_MAP_URL=https://my-cdn.com/module-map.json

Default Value

# if NODE_ENV=development
HOLOCRON_MODULE_MAP_URL=http://localhost:3001/static/module-map.json
# else
HOLOCRON_MODULE_MAP_URL=undefined

HOLOCRON_SERVER_MAX_MODULES_RETRY

Runs In

  • ✅ Production
  • ✅ Development

Maximum amount of times One App should retry on failed module fetches.

Shape

HOLOCRON_SERVER_MAX_MODULES_RETRY=Number

Default Value

HOLOCRON_SERVER_MAX_MODULES_RETRY=3

HOLOCRON_SERVER_MAX_SIM_MODULES_FETCH

Runs In

  • ✅ Production
  • ✅ Development

Maximum number of Holocron Modules One App will try to load at a time when new Modules are found in Module Map.

Useful to configure in case of a large module map and/or a bad network connection.

Shape

HOLOCRON_SERVER_MAX_SIM_MODULES_FETCH=Number

Default Value

HOLOCRON_SERVER_MAX_SIM_MODULES_FETCH=30

HTTPS_PORT

⚠️ Requires HTTPS_PRIVATE_KEY_PATH and HTTPS_PUBLIC_CERT_CHAIN_PATH to be set.

Runs In

  • ✅ Production
  • ✅ Development

Sets the port on which One App will listen for requests.

Shape

HTTPS_PORT=Number

Example

HTTPS_PORT=443

HTTPS_PRIVATE_KEY_PASS_FILE_PATH

Runs In

  • ✅ Production
  • ✅ Development

The file path to a file containing a shared passphrase for single private key (See Node documentation on passphrase for tls.createSecureContext).

Shape

HTTPS_PRIVATE_KEY_PASS_FILE_PATH=String

Example

HTTPS_PRIVATE_KEY_PASS_FILE_PATH=./some-extra-certs.pem

HTTPS_PRIVATE_KEY_PATH

Runs In

  • ✅ Production
  • ✅ Development

The file path to the private key of an SSL Certificate.

Shape

HTTPS_PRIVATE_KEY_PATH=String

Example

HTTPS_PRIVATE_KEY_PATH=./some-private-key.pem

HTTPS_PUBLIC_CERT_CHAIN_PATH

⚠️ Required by HTTPS_PORT

Runs In

  • ✅ Production
  • ✅ Development

The file path to the public key of an SSL Certificate.

Shape

HTTPS_PUBLIC_CERT_CHAIN_PATH=String

Example

HTTPS_PUBLIC_CERT_CHAIN_PATH=./some-cert.pem

HTTPS_TRUSTED_CA_PATH

⚠️ Required by HTTPS_PORT

Runs In

  • ✅ Production
  • ✅ Development

The file path to a file containing one or more certs to trust over the system default. See Node documentation on ca option in tls.createSecureContext.

Shape

HTTPS_TRUSTED_CA_PATH=String

Example

HTTPS_TRUSTED_CA_PATH=./some-extra-certs.pem

HTTP_METRICS_PORT

Runs In

  • ✅ Production
  • ✅ Development

Sets the port on which One App's metrics server (e.g. Prometheus) will listen for requests.

Shape

HTTP_METRICS_PORT=Number

Default Value

HTTP_METRICS_PORT=3005

HTTP_ONE_APP_DEV_CDN_PORT

Runs In

  • 🚫 Production
  • ✅ Development

Sets the port on which the One App Dev CDN server will listen for requests. It defaults to 3001 if NODE_ENV is development, otherwise it is undefined as it is only used for local development.

Shape

HTTP_ONE_APP_DEV_CDN_PORT=Number

Default Value

# if NODE_ENV=development
HTTP_ONE_APP_DEV_CDN_PORT=3001
# else
HTTP_ONE_APP_DEV_CDN_PORT=undefined

HTTP_ONE_APP_DEV_PROXY_SERVER_PORT

Runs In

  • 🚫 Production
  • ✅ Development

Sets the port on which the One App Dev Proxy server will listen for requests. It defaults to 3002 if NODE_ENV is development, otherwise it is undefined as it is only used for local development.

Shape

HTTP_ONE_APP_DEV_PROXY_SERVER_PORT=Number

Default Value

# if NODE_ENV=development
HTTP_ONE_APP_DEV_PROXY_SERVER_PORT=3002
# else
HTTP_ONE_APP_DEV_PROXY_SERVER_PORT=undefined

HTTP_PORT

Runs In

  • ✅ Production
  • ✅ Development

Sets the port on which One App will listen for requests.

Shape

HTTP_PORT=Number

Default Value

HTTP_PORT=3000

IP_ADDRESS

Runs In

  • ✅ Production
  • ✅ Development

Specify a specific IP Address for One App to bind to.

Shape

IP_ADDRESS=String

Example

IP_ADDRESS=192.168.1.1

NODE_ENV

Runs In

  • ✅ Production
  • ✅ Development

May be set to either production or development. When set to development additional tooling such as one-app-dev-cdn and one-app-dev-proxy is provided to help with local development. It is undefined by default.

Setting this to development will set a lot of the other environment variables for you to provide sane development time defaults.

Example

NODE_ENV=production

ONE_CLIENT_CDN_URL

⚠️ Required In Production

Runs In

  • ✅ Production
  • ✅ Development

Fully qualified base path URL where the Module Bundle folders are located (See Module Map).

Shape

ONE_CLIENT_CDN_URL=String

Example

ONE_CLIENT_CDN_URL=https://app-cdn.com/statics/

Default Value

# if NODE_ENV=development
ONE_CLIENT_CDN_URL=/_/static/
# else
ONE_CLIENT_CDN_URL=undefined

ONE_CLIENT_LOCALE_FILENAME

Runs In

  • ✅ Production
  • ✅ Development

Locale file name for module language packs. Modifying this per environment allows for modules to have different language packs in different environments.

Must be one of integration, qa, or be undefined (for production). It is undefined by default.

Shape

ONE_CLIENT_LOCALE_FILENAME=String

Example

ONE_CLIENT_LOCALE_FILENAME=integration

Default Value

ONE_CLIENT_LOCALE_FILENAME=undefined

ONE_CLIENT_REPORTING_URL

⚠️ Required In Production

Runs In

  • ✅ Production
  • ✅ Development

URL where browser should send client side errors to. Defaults to /_/report/errors if NODE_ENV is set to development and is undefined otherwise.

Shape

ONE_CLIENT_REPORTING_URL=String

Example

ONE_CLIENT_REPORTING_URL=https://my-app-errors.com/client

Default Value

# if NODE_ENV=development
ONE_CLIENT_REPORTING_URL=/_/report/errors
# else
ONE_CLIENT_REPORTING_URL=undefined

ONE_CLIENT_CSP_REPORTING_URL

⚠️ Required In Production

Runs In

  • ✅ Production
  • ✅ Development

URL where browser should send CSP errors to. Defaults to /_/report/security/csp-violation if NODE_ENV is set to development and is undefined otherwise.

Shape

ONE_CLIENT_CSP_REPORTING_URL=String

Example

ONE_CLIENT_CSP_REPORTING_URL=https://my-app-csp-violations.example.com/client

Default Value

# if NODE_ENV=development
ONE_CLIENT_CSP_REPORTING_URL=/_/report/security/csp-violation
# else
ONE_CLIENT_CSP_REPORTING_URL=undefined


## `ONE_CLIENT_ROOT_MODULE_NAME`

⚠️ Required In Production & Development

**Runs In**
* ✅ Production
* ✅ Development

Name of the module that serves as the entry point to your application. In local development this is
not necessary as you can pass the [`--root-module-name` argument to `npm start`](./Cli-Commands.md#start-commands) instead.

**Shape**
```bash
ONE_CLIENT_ROOT_MODULE_NAME=String

Example

ONE_CLIENT_ROOT_MODULE_NAME=frank-lloyd-root

ONE_CONFIG_ENV

Runs In

  • ✅ Production
  • ✅ Development

An arbitrary String key that is used to look up values provided in App Configuration's provideStateConfig for its children modules.

Shape

ONE_CONFIG_ENV=String

Example

ONE_CONFIG_ENV=staging

Default Value

ONE_CONFIG_ENV=undefined

ONE_CONFIG_USE_NATIVE_INTL

Runs In

  • ✅ Production
  • ✅ Development

Feature flag to disable lean-intl polyfill. This allows you to use modern intl features such as timezones, but will result in your application supporting fewer older browsers.

Shape

ONE_CONFIG_USE_NATIVE_INTL=Boolean

Example

ONE_CONFIG_USE_NATIVE_INTL=true

Default Value

ONE_CONFIG_USE_NATIVE_INTL=false

ONE_DANGEROUSLY_ACCEPT_BREAKING_EXTERNALS

Runs In

  • ✅ Production
  • ✅ Development

If set to true, one-app will not throw an error when externals provided by the root module and externals required by child modules have conflicting semver ranges. This flag is meant to ease the transition to newer versions of externals. It should not be kept on for long as mismatching versions of packages can cause unexpected issues.

Shape

ONE_DANGEROUSLY_ACCEPT_BREAKING_EXTERNALS=true

Example

ONE_DANGEROUSLY_ACCEPT_BREAKING_EXTERNALS=true

Default Value

ONE_DANGEROUSLY_ACCEPT_BREAKING_EXTERNALS=undefined

ONE_CSP_ALLOW_INLINE_SCRIPTS

Runs In

  • 🚫 Production
  • ✅ Development

If set to true, one-app will not prepend a script nonce to the script-src CSP. This will allow inline scripts to be executed in development - for example, to allow browser devtools to inject content scripts in some browsers that otherwise restrict this.

Shape

ONE_CSP_ALLOW_INLINE_SCRIPTS=true

Example

ONE_CSP_ALLOW_INLINE_SCRIPTS=true

Default Value

ONE_CSP_ALLOW_INLINE_SCRIPTS=undefined

ONE_DANGEROUSLY_DISABLE_CSP

Runs In

  • 🚫 Production
  • ✅ Development

If set to true, one-app will not throw an error when a valid Content Security Policy (CSP) is not present. This flag is meant to allow any module to be ran as a root module and to allow root modules to bypass the CSP requirement so long as NODE_ENV is development. When NODE_ENV is development and ONE_DANGEROUSLY_DISABLE_CSP is true a CSP header will not be set.

Shape

ONE_DANGEROUSLY_DISABLE_CSP=Boolean

Example

ONE_DANGEROUSLY_DISABLE_CSP=true

Default Value

ONE_DANGEROUSLY_DISABLE_CSP=false

ONE_ENABLE_POST_TO_MODULE_ROUTES

Runs In

  • ✅ Production
  • ✅ Development

Set to true if One App should respond to POST requests.

Shape

ONE_ENABLE_POST_TO_MODULE_ROUTES=Boolean

Example

ONE_ENABLE_POST_TO_MODULE_ROUTES=true

Default Value

ONE_ENABLE_POST_TO_MODULE_ROUTES=false

ONE_MAX_POST_REQUEST_PAYLOAD

Runs In

  • ✅ Production
  • ✅ Development

Maximum payload allowed in POST requests. Has no effect unless ONE_ENABLE_POST_TO_MODULE_ROUTES is set to true.

Shape

ONE_MAX_POST_REQUEST_PAYLOAD=String

Example

ONE_MAX_POST_REQUEST_PAYLOAD=100kb

Default Value

ONE_MAX_POST_REQUEST_PAYLOAD=15kb

ONE_MAP_POLLING_MAX

Runs In

  • ✅ Production
  • ✅ Development

Maximum time allowed between module map polls for new modules from One App (in seconds).

Shape

ONE_MAP_POLLING_MAX=Number

Default Value

ONE_MAP_POLLING_MAX=300

ONE_MAP_POLLING_MIN

Runs In

  • ✅ Production
  • ✅ Development

Minimum time allowed between Module Map polls for new modules from One App (in seconds).

Shape

ONE_MAP_POLLING_MIN=Number

Default Value

ONE_MAP_POLLING_MIN=0

ONE_REFERRER_POLICY_OVERRIDE

Runs In

  • ✅ Production
  • ✅ Development

Overrides the Referrer-Policy header.

Must be one of: no-referrer, no-referrer-when-downgrade, same-origin or strict-origin.

Shape

ONE_REFERRER_POLICY_OVERRIDE=String

Example

ONE_REFERRER_POLICY_OVERRIDE=no-referrer

Default Value

ONE_REFERRER_POLICY_OVERRIDE=same-origin

ONE_SERVICE_WORKER

Runs In

  • ✅ Production
  • ✅ Development

Feature flag to enable service worker and PWA feature, defaults to false.

Shape

ONE_SERVICE_WORKER=Boolean

Example

ONE_SERVICE_WORKER=true

Default Value

ONE_SERVICE_WORKER=false

📘 More Information

OTEL_EXPORTER_OTLP_LOGS_ENDPOINT

Runs In

  • ✅ Production
  • ✅ Development

When set, One App will emit OpenTelemetry logs over GRPC to the configured endpoint. See the OpenTlemetry documentation for more information.

Shape

OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=String

Example

OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=http://localhost:4317/v1/logs

OTEL_EXPORTER_OTLP_TRACES_ENDPOINT

Runs In

  • ✅ Production
  • ✅ Development

When set, One App will emit OpenTelemetry traces over GRPC to the configured endpoint. See the OpenTelemetry documentation for more information.

Shape

OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=String

Example

OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4317/v1/traces

OTEL_SERVICE_NAME

Runs In

  • ✅ Production
  • ✅ Development

Service name for OpenTelemtry resource. See OTel Environment Variable Specification for more details

Shape

OTEL_SERVICE_NAME=String

Example

OTEL_SERVICE_NAME=MyApplication

OTEL_SERVICE_NAMESPACE

Runs In

  • ✅ Production
  • ✅ Development

Service namespace for OpenTelemtry resource.

Shape

OTEL_SERVICE_NAMESPACE=String

Example

OTEL_SERVICE_NAMESPACE=MyApplicationNamespace

OTEL_RESOURCE_ATTRIBUTES

Runs In

  • ✅ Production
  • ✅ Development

Additional OpenTelemetry resource attributes in W3C Baggage format. See OTel Environment Variable Specification] & OTel Resource SDK documentation for more details.

Shape

OTEL_RESOURCE_ATTRIBUTES=String

Example

OTEL_RESOURCE_ATTRIBUTES="foo=bar,baz=qux"

ONE_TRACE_ALL_REQUESTS

Runs In

  • ✅ Production
  • ✅ Development

Requests made to one-app's internal routes (those starting with /_/), requests to any other port than HTTPS_PORT or HTTP_PORT, and outgoing requests not associated with an incoming request are not traced by default. Setting this to true will trace all requests.

Shape

ONE_TRACE_ALL_REQUESTS=Boolean

Example

ONE_TRACE_ALL_REQUESTS=true

ONE_ENABLE_REQUEST_LOGGING_WHILE_TRACING

Runs In

  • ✅ Production
  • ✅ Development

When tracing is enabled, request logging is disabled by default. Setting this to true will re-enable it.

Shape

ONE_ENABLE_REQUEST_LOGGING_WHILE_TRACING=Boolean

Example

ONE_ENABLE_REQUEST_LOGGING_WHILE_TRACING=true

☝️ Return To Top