dotenv-org / dotenv-vault

sync .env files—from the creator of `dotenv`.
https://www.dotenv.org
MIT License
1.11k stars 32 forks source link

Error: Cannot find .env.me (DOTENV_ME) #343

Open roman-supy-io opened 2 months ago

roman-supy-io commented 2 months ago

I'm using --dotenvMe flag to pass the key instead of using .env.me and due to how our CICD (Tekton) is configured, we cannot use .env.me

The problem is that running this locally even without .env.me works fine:

npx --yes dotenv-vault pull -m=it_........

but running the same in Docker does not:


........

ARG BUILD_CONFIG=development
ARG DOTENV_ME

........

RUN echo "BUILD_CONFIG is: $BUILD_CONFIG" # outputs "production"
RUN echo "ENV.ME is: $DOTENV_ME" # outputs "it_...."

RUN npx --yes dotenv-vault pull -m=$DOTENV_ME $BUILD_CONFIG .env.$BUILD_CONFIG

the error is:

INFO[0233] RUN DOTENV_ME=$DOTENV_ME npx --yes dotenv-vault@latest pull -m=$DOTENV_ME $BUILD_CONFIG .env.$BUILD_CONFIG 
INFO[0236] Cmd: /bin/sh                                 
INFO[0236] Args: [npx --yes dotenv-vault@latest pull -m=$DOTENV_ME $BUILD_CONFIG .env.$BUILD_CONFIG] 
INFO[0236] Running: [/bin/sh npx --yes dotenv-vault@latest pull -m=$DOTENV_ME $BUILD_CONFIG .env.$BUILD_CONFIG] 
npm warn deprecated @oclif/screen@3.0.8: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
remote:   Securely pulling development... aborting
x Aborted.
Code: NOT_FOUND_DOTENV_ME
Suggestion: run command: $ npx dotenv-vault login
 ›   Error: Cannot find .env.me (DOTENV_ME)
error building image: error building stage: failed to execute command: waiting for process to exit: exit status 2

any thoughts?

motdotla commented 2 months ago

i think $DOTENV_ME needs to be wrapped in quotes here to work correctly with sh. can you try that?

-m="$DOTENV_ME"

roman-supy-io commented 2 months ago

i think $DOTENV_ME needs to be wrapped in quotes here to work correctly with sh. can you try that?

-m="$DOTENV_ME"

@motdotla unfortunately that didn't work :(

roman-supy-io commented 2 months ago

@motdotla can you try to reproduce with a simple Dockerfile?