Replies: 1 comment
-
I think the most obvious solution here might be to just use the command line flag. In that way the used database url is not hidden for others.
(That works with `OTHER=your_db_url diesel setup) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a project with several services using several databases via diesel.
Because of this, I often have to use the diesel cli with several different projects, and it needs to know the database url.
Per docs:
The workflow I have created involves using option 2 here -- each project has its own
.env
and when Icd
to that directory, the diesel-cli picks up the rightDATABASE_URL
this way. This is much less onerous than passing via--database-url
flag or resetting the environment variable by hand every time I change contexts.The problem I have now is that we have a need to change the name of this env
DATABASE_URL
in the actual server configs. But, AFAICT, there is no way to makediesel-cli
read a different env variable, it always reads onlyDATABASE_URL
.In my ideal world, we could override the name of the env that diesel cli reads by setting an option in
diesel.toml
, which is project specific.I could instead have the
.env
in each directory reserved for the diesel cli, and a different env file which the server actually reads But then I will have to keep these in sync if the dev environment changes, and I'm sure that it will trip up some future engineer who won't know about the.env
file which is read only by diesel cli, because it will become very obscure.The other option I thought of is along these lines, using the variable expansion features of
dotenvy
/dotenvs
:This works but it's a bit messy compared to the ease of setting something in
diesel.toml
.How do you deal with this problem? Do you have a better suggestion?
Beta Was this translation helpful? Give feedback.
All reactions