New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CLI Flag to specify .env
file location
#3435
Comments
Taking environments directly from the machine you're building your code with is a security risk and might cause conflicts between the Parcel runtime and environment as we also use environment variables for Parcel itself. I'm pretty sure it's still supported in the cli though, not sure why it isn't working for you |
@DeMoorJasper do you have any idea where it is in the docs? I really didn't find a way to configure this |
There's an entire section on environment variables: https://en.parceljs.org/env.html |
Yes but there's no way to provide a specific path for the env file if none of the options can be applied to the project (i.e: |
Ow no there isn't I meant injecting env variables should work in theory, or make a symlink from dev.env to config/dev.env that should also work... |
You're right, that's a way to work it around but I didn't want to pollute the root dir with all the .env files (or associated symlinks 🙃). Anyway if the ability to customize the .env location in CLI is not considered for the near future we can close this issue (sigh 😢). Your call! |
@damianobarbati it might be an option for v2, I'll leave it open. |
.env
file location
@DeMoorJasper I adapted to the standard, so .env.< environment > |
So, how can you specifiy the .env file that parcel v2 should use? I want to build different versions of the product that have different .env files (eg. .env.prod.premium), how can I pass that .env file to parcel build? |
via parcel/packages/core/core/src/loadDotEnv.js Lines 16 to 25 in 8a4fa3e
|
Hey guys! Anyone knows how to specify the file directly? Looks like parcel searches in process.cwd which is not how dotenv works and thus parcel won't work properly with namespaces - e.g. |
Moreover, doc specifies that:
However, in fact parcel looks for the .env files in a folder where |
Add a
--env <env-file>
flag to the cli to have the ability to store env files outside of root directory and/or have custom env filenamesOriginal issue:
The text was updated successfully, but these errors were encountered: