You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation currently states (emphasis mine):
you can also use the CONFIG_PATH environment variable to instruct Directus to use a local configuration file instead of environment variables.
In my opinion, that is not completely accurate as the env package is reading both, the environment variables (read via process.env) and the respective CONFIG_PATH (.env, config.json, config.yaml, or config.js file).
Because of that, if I define an environment variable FOOBAR and set the environment variable CONFIG_PATH to config.json (which does not contain FOOBAR), my application would still have access to FOOBAR.
Also, it is common for environment variables to take precedence over local configuration files. For Directus, it is the other way around: The configuration files take precedence over environment variables. Thus, making it impossible to keep common configuration in a config file (and bake it into a Docker file for example) and controlling certain configuration via explicitly set environment variable (e.g. passed via -e MY_ENV_VAR in the Docker run command).
The text was updated successfully, but these errors were encountered:
Adding to the inconsistencies, if you have the env variable FOOBAR=1 and the config entry FOOBAR=2. You will get 2 different values depending if you use @directus/env or process.env..
I remember this was not the case in older versions. Config used to override the value in the environment which then was accessed using process.env.
Page
https://docs.directus.io/self-hosted/config-options.html#configuration-files
Describe the Inaccuracy
The documentation currently states (emphasis mine):
In my opinion, that is not completely accurate as the env package is reading both, the environment variables (read via
process.env
) and the respectiveCONFIG_PATH
(.env
,config.json
,config.yaml
, orconfig.js
file).Because of that, if I define an environment variable
FOOBAR
and set the environment variableCONFIG_PATH
toconfig.json
(which does not containFOOBAR
), my application would still have access toFOOBAR
.Also, it is common for environment variables to take precedence over local configuration files. For Directus, it is the other way around: The configuration files take precedence over environment variables. Thus, making it impossible to keep common configuration in a config file (and bake it into a Docker file for example) and controlling certain configuration via explicitly set environment variable (e.g. passed via
-e MY_ENV_VAR
in the Docker run command).The text was updated successfully, but these errors were encountered: