Coder Social home page Coder Social logo

`--env-file` watch about node HOT 3 CLOSED

OliverJAsh avatar OliverJAsh commented on August 30, 2024 1
`--env-file` watch

from node.

Comments (3)

MoLow avatar MoLow commented on August 30, 2024

this should probably be the default, without an extra flag

from node.

tniessen avatar tniessen commented on August 30, 2024

--watch-path=.env doesn't help either. It does restart the script when the env file changes, however the env file is not loaded again, so the script only has access to the environment variables that were loaded when the command was first ran.

I assume that the node process loads .env, then starts the actual application as a child process with the same --env-file flag. This should cause the child process to load the environment file upon start, however, the child process inherits the environment variables from the parent process, and inherited environment variables take precedence over variables read from .env, so you wouldn't see any changes to existing environment variables.

To test this hypothesis, could you check if you can see new variables in the child process when you add a new entry to .env while --watch is running?

from node.

OliverJAsh avatar OliverJAsh commented on August 30, 2024

To test this hypothesis, could you check if you can see new variables in the child process when you add a new entry to .env while --watch is running?

I just tested this and I can! You're right.

from node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.