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

[bug] bud.env somehow pulling local env vars into remote environment #2655

Open
3 tasks done
rguttersohn opened this issue Oct 12, 2024 · 1 comment
Open
3 tasks done
Labels
bug Something isn't working

Comments

@rguttersohn
Copy link

rguttersohn commented Oct 12, 2024

Agreement

Describe the issue

It appears bud.env is bringing my public development env vars to my remote environment instead of using the remote .env file.

For example:

My dev env file:

PUBLIC_TOKEN='dev_token'

My staging env file:

PUBLIC_TOKEN='staging_token'

if I have console.log(TOKEN), in the dev and staging env, it returns 'dev_token'.

I also added a env var to staging only called PUBLIC_TEST. On staging, console.log(TEST) returns 'undefined'.

Expected Behavior

Dev public env vars should only be accessible in the dev environment. Staging public env vars should only be accessible in the staging environment.

Actual Behavior

When adding env vars, the local dev vars are being used in a remote staging env instead of the public vars from the remote .env file.

Steps To Reproduce

  1. Add a env var to staging and another to dev and add a console.log for the var.
  2. Provision staging server.
  3. Deploy staging codebase
  4. check the console.log and see if it returns the dev env var.

version

6.23.3

Logs

No response

Configuration

No response

Relevant .budfiles

No response

@rguttersohn rguttersohn added the bug Something isn't working label Oct 12, 2024
@kellymears
Copy link
Contributor

I don't think it's possible for bud.js to do this.

This is the code that reads the env file:

https://github.com/roots/bud/blob/main/sources/@roots/bud-framework/src/bootstrap/env/index.ts#L64-L94

There is no caching involved; it is a straight filesystem read. I think the value must be set incorrectly in the .env file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants