Protect what matters – even after you're gone. Make a plan for your digital legacy today.
Forum Discussion
tjchambers
2 months agoNew Contributor
.env file comments preventing use of .env
I really want to like the local .env handling. However the header inserted in the .env file as a "warning comment" is interfering with my usage. If I regenerate the .env file from 1Password af...
- 2 months ago
Hey tjchambers,
Thanks for trying out the local .env feature and sharing your feedback!
You can get this working without removing the header by using a slightly different command:
set -a source .env set +aor
export $(grep -vE '^(#|$)' .env | xargs)Those should properly ignores comments in the file and load only the actual key-value pairs.
The issue you’re seeing happens because `export $(< .env)` assumes there are no comments or extra lines in the file, so it tries to export "1Password." as a variable name and errors out.
Does that help?
sid
1Password Team
2 months agoHey tjchambers,
Thanks for trying out the local .env feature and sharing your feedback!
You can get this working without removing the header by using a slightly different command:
set -a
source .env
set +aor
export $(grep -vE '^(#|$)' .env | xargs)Those should properly ignores comments in the file and load only the actual key-value pairs.
The issue you’re seeing happens because `export $(< .env)` assumes there are no comments or extra lines in the file, so it tries to export "1Password." as a variable name and errors out.
Does that help?