Composing environment variables #9458
-
SummaryI am trying to wrap my head around how environment variables should be handled. I understand that instead of having a single
First: is the above usage of "packages" is referring to Application Packages, Internal Packages, or both? The surrounding context leads me to believe that "packages" is referring to Application Packages:
It makes sense to me that the environment variables would be application-scoped, but please correct me if I'm wrong. To be clear, my understanding is that the repository should look like this:
In the structure above, In some cases, I feel it would make sense for my If I structure my repository such that my
How would I go about composing the environment variables for Unrelated question: what's a use-case in which References |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Good question, and you're thinking about things attentively. I appreciate the thoughtfully worded question(s). The way that I like thinking about it is: When I run my code locally, I'm simulating what happens in production. You don't run packages, you run applications that are composed of packages (which is something you correctly alluded to). With that mental model, you start to realize that a package has no independent runtime. It only runs within the context of an application. So, if I want to model that locally, that would mean I only use There's an exception: If you're running scripts directly in packages that require environment variables, you might be forced to put a |
Beta Was this translation helpful? Give feedback.
Good question, and you're thinking about things attentively. I appreciate the thoughtfully worded question(s).
The way that I like thinking about it is: When I run my code locally, I'm simulating what happens in production. You don't run packages, you run applications that are composed of packages (which is something you correctly alluded to).
With that mental model, you start to realize that a package has no independent runtime. It only runs within the context of an application. So, if I want to model that locally, that would mean I only use
.env
files in applications.There's an exception: If you're running scripts directly in packages that require environment variables, you might be fo…