Skip to content
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

envify does not correctly change/update the value of a changed secret environment variable #512

Closed
Antvirf opened this issue Oct 3, 2023 · 2 comments · Fixed by #557
Closed

Comments

@Antvirf
Copy link

Antvirf commented Oct 3, 2023

Not sure what's going on here, seems like the local part of envify is working exactly as expected, but the transfer to the target machine seems to somehow be cached in a way I do not understand and haven't found a reference to in the docs.

Steps to replicate the issue

  1. Add a new line to .env.erb, ASD="asd"
  2. Run kamal envify. Now my local .env file has the line ASD="asd"
  3. On the target machine, run cat .kamal/env/roles/myapp.env | grep ASD - nothing shows up, as its not in config yet
  4. Add the variable as a secret to deploy.yml:
env:
  secret:
    - ASD
  1. Run kamal envify
  2. On the target machine, run cat .kamal/env/roles/myapp.env | grep ASD - now I get a value ASD=asd as expected
  3. Change the value in .env.erb to ASD="def"
  4. Run kamal envify. Now my local .env file has the line ASD="def" as expected
  5. On the target machine, run cat .kamal/env/roles/myapp.env | grep ASD - this still gives ASD=asd

Other notes/info

  • I have tried clearing .kamal/env/ directory entirely, this does not work either. The old value for the secret is still pushed to the target machine.
  • My target machine is an AWS EC2 instance
@frenkel
Copy link

frenkel commented Oct 16, 2023

Did you forget to run kamal env push?

djmb added a commit that referenced this issue Oct 30, 2023
Calling `load_envs` again does not load updated env variables, because
Dotenv does not overwrite existing values.

To fix this we'll store the original ENV and reset to it before
reloading.

#512
@djmb
Copy link
Collaborator

djmb commented Oct 30, 2023

Hi @Antvirf, thanks you for this report. I had seen this issue but not got to the bottom of it so this report was very useful!

Should be resolved by #557

@djmb djmb closed this as completed in #557 Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants