Open Husamui opened 5 months ago
@Husamui try also setting an env variable DOTENV_CONFIG_PATH=path/to/.env.vault
then update your dotenv.config to use that path in its options
@Husamui nevermind -- that was bad advice -- trying to sort through the same issue myself
@Husamui and @validkeys - dotenv-vault is possible to get going with monorepos but it's a bit awkward.
you need a .env.vaut and DOTENV_KEY per sub project under you monorepo
we have a better answer to monorepos with dotenvx. it has support for doing things like:
dotenvx encrypt
dotenvx encrypt apps/backend
dotenvx encrypt apps/frontend
so that you can have vaults per project in your monorepo. it's a much better experience.
but caveat: the hub
(team) features of dotenvx are not comparable to dotenv-vault yet.
summary: once dotenvx's team features mature over the next 6 months, i would recommend choosing it over dotenv-vault.
we using NX monorepo for our projects.
Steps:
export DOTENV_KEY='dotenv:xxxxx
in the command line before serving the app.require('dotenv').config();
in rootDirectory/apps/app_name/src/main.ts.we got the following warnings in the console when serving the app even though the app server correctly and include the env variables (I believe because .env loading the env variables from step 2)
any suggests?