Use .env file instead of static config.yml
closed
Nicolas Giard
closed
M
Matt P
Using environmental variables in config.yml is supported already.
So assuming you are using environmental variables already in config.yml and you want to use dotenv for setting your development environment, you can just follow dotenv's recommended approach using preload (eg in your package.json start-dev type script).
Using dotenv preload allows you to use dotenv as a dev dependency for applications that rely on ENV without wiki.js needing to care about dotenv. Needed every package that uses env to have dotenv as an integrated dependency doesn't make sense which is why the preload approach is recommended.
If you aren't developing on wiki.js you probably don't need/want .env anyway as that is geared towards development. Production config should be passed as normal environment variables (e.g. via systemd unit or pm2 manifest) and not use a .env file.