-
Notifications
You must be signed in to change notification settings - Fork 136
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
.env
files in services/* directory breaks runtime start
#2132
Comments
I can take a look at this, @leorossi |
Great, thanks! |
@leorossi, what's the best way to debug this? I am using VSCode. Are there platformatic-specific instructions somewhere? :) |
You can run https://github.com/platformatic/platformatic/blob/main/packages/cli/cli.js with |
I believe the error comes from the ConfigManager.. here: packages/config/lib/manager.js I'll look deeper tomorrow! :) |
The problem is a worker thread starts looking for a One solution could be to read all the |
Or, since the worker thread runs only in runtimes, the |
I like the idea here @leorossi .. however, if you see, the It would be simpler, I think, for the user to know that the only .env to be read is the root dir's.. but it is an open question at this point what our strategy of parsing I am in favor of supporting just 1 |
I agree with not loading those. |
I'll try to check in a fix tomorrow..🙂 |
I think I am too new to tackle this.. 🙁! |
Hi @leorossi , I have tried and there's common logic for reading config -- that will need to be refactored, somewhat! |
Please guide Me..❤️ 🙏 @mcollina |
Unfortunately we have no time to give you step-by-step instructions. |
Not asking for step-by-step instructions, @mcollina :) Just looking for advice but never-mind then 🙂! |
This env-related code is hard-to-parse @mcollina :) . I'll refactor what I can 🙂! |
@leorossi, it can also be that we always default to the We can also make it an option in the configuration file for the service(for the user to specify), or have the runtime pass it to the services as they start up..this will likely not be trivial. Nor are the other options. We can::
Let me know what we prefer! |
|
Thanks, @mcollina. I'll begin work on this tomorrow. Maybe I should pick up to 3 tasks & work on them in parallel! |
@bobss24 take a look at https://github.com/leorossi/dotenv-tool it's already imported in |
thx @leorossi! ❤️ I'll take a look when I am back from vacation! 🙂 ❤️ |
I'm back.❤️ will take a look tomorrow, if all goes to plan.. :) |
@leorossi thx for the suggestion here. I am not understanding how to use this. If we were collating the two .env's, I would have found your tool quite helpful for it. Here, the problem seems to be different wherein, instead of combining the two environment var config files, it stops looking for others. We have already decided to use the top-level .env in this case, ignoring what the service has in its directory!🍀 |
In a Platformatic Runtime, if thre is a
.env
file inside a service directory, seems like it is loaded in place of the root.env
one.This happens only if the service's
platformatic.json
file contains a reference to an env variable likeRepro:
Select
Application
and create the first (and only service)Once finished ensure that the runtime starts correctly and stop it. Then
Start again and you'll see that an error occurs, complaining that an env variable is missing.
The
.env
file inside the service should be either ignored or loaded together with the root oneThe text was updated successfully, but these errors were encountered: