Forum Discussion

tjchambers's avatar
tjchambers
New Member
4 days ago
Solved

.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...
  • sid's avatar
    4 days 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 +a

    or

    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?