You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 22, 2023. It is now read-only.
Our repo has a bunch of apps, but they all talk to the same database. Would be cool if we could specify the db url in a centralized manner, with a topmost .env file, rather than in every project separately.
Seems like a perfect usecase for a plugin - "Before every rush command, use dotenv". Ideally it would also work on rushx, though I don't remember if it's currently possible to plug in to rushx behaviour.
The text was updated successfully, but these errors were encountered:
Technically yes. You can do it by rush plugin right now but only for rush commands.
ideally it would also work on rushx
Nope. rushx is treated as pnpx. I don't believe pnpx is the right CLI to plugin things.
I am not 100% sure it's helpful if you can inject .env files for all commands. Since connecting to database seems to be a very specified behavior of a command in each project rather than the management in whole repo. If so, your point is mainly about reusablity in Monorepo, and the solution in RushStack world is rig package. IMHO, .env in your case is another configuration can be included in a rig, and loading .env for the specified command.
The workflow would be like:
Create a sibling rig package in your monorepo to manage .env file and provide a env-loader js file.
Make project A depends on this rig package.
Loading .env in each project, use webpack as an example:
Our repo has a bunch of apps, but they all talk to the same database. Would be cool if we could specify the db url in a centralized manner, with a topmost
.env
file, rather than in every project separately.Seems like a perfect usecase for a plugin - "Before every
rush
command, usedotenv
". Ideally it would also work onrushx
, though I don't remember if it's currently possible to plug in torushx
behaviour.The text was updated successfully, but these errors were encountered: