Skip to content

Using environment variables

Lennart Fleischmann edited this page Oct 16, 2024 · 4 revisions

The Hanko backend can also configured using using environment variables. Environment variables have higher precedence than configuration via file (i.e. if provided, the values provided overwrite the values given in the configuration file - multivalued options, like arrays, are also not merged but overwritten entirely).

To set environment variables, join (nested) configuration keys by _ (underscore) and uppercase the keys, i.e. for service.name use

export SERVICE_NAME="Hanko Authentication Service"

Keys that themselves consist of multiple words that are separated by an underscore are provided in the same way, i.e. for email.require_verification use:

export EMAIL_REQUIRE_VERIFICATION=false

Values for multivalued options, like arrays, where values are "primitives" (i.e. not themselves complex structures) must be provided in a comma separated list, e.g. for server.webauthn.relying_party.origins use:

export SERVER_WEBAUTHN_RELYING_PARTY_ORIGINS="https://hanko.io,android:apk-key-hash:nLSu7w..."

Some configuration options further require a special format because their values are complex. One such example is the webhooks.hooks option for configuring Webhooks. To configure this option via environment variables you must specify hooks in the following format:

export WEBHOOKS_HOOKS='{"callback":"http://app.com/usercb","events":["user"]};{"callback":"http://app.com/emailcb","events":["email.send"]}'

To find out whether a configuration option requires a special format consult its in-depth description in the reference.

Clone this wiki locally