-
Notifications
You must be signed in to change notification settings - Fork 1
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
Global variables do not get populated to .env if start from scratch #5
Comments
You seem to be putting them into the DDEV global configuration in https://github.com/DiffyWebsite/ddev-diffy/blob/main/install.yaml#L15-L43 Those populate the web container. I guess you're then trying to set them for the diffy container in Lines 87 to 88 in e49bb8c
You seem to be using {{ $foundDiffAPIKey }} in https://github.com/DiffyWebsite/ddev-diffy/blob/main/install.yaml#L61 (probably a typo anyway, should be $foundDiffyAPIKey ?) but I don't see where that has ever been set. I also don't really understand why you ever put those into the global config instead of just putting them into the diffy .env to begin with. |
Oh, I see super-complicated
That's probably a bad idea (and apparently isn't working) |
Worker code we would love to keep outside of ddev-diffy repo as it is used elsewhere in the system (like on our actual production workers). API Key is a variable to store in global configuration as you might have multiple ddev projects using it. So user doesn't need to re-enter it over and over again. @rfay Does it make sense to simplify all this by asking users simply to add values to .env file directly? That will be the most straight forward solution. |
I think the problem you're having with this approach is that you're counting on |
Think about why you're populating the global config and web config anyway. Will it be used in the web container? |
It won't be used in web container at all. |
Seems like a mistake to be adding it as environment variables at all then... Instead of doing that, add it to the .env to begin with? You could check the .env instead of checking the global and project config, then add it there? |
ok. Let me do that instead. Thank you. I'll make it much simpler. |
BTW, thanks for all your exploration here. I'm quite sure ddev-platformsh can be improved since DDEV has evolved and has more capabilities than it did when it was originally done. Maybe we can improve things there, especially using a .env, which is better than editing global config, etc. |
Interestingly enough, DDEV already loads godotenv and could use it in the future to read or (write?) arbitrary .env files. |
@rfay I have simplified the addon. I am not asking for the credentials during installation and have instructions to add |
Steps to reproduce:
.ddev/config.yaml
file~/.ddev/global_config.yaml
fileddev get diffywebsite/ddev-diffy
, provide API key and project ID during the installationdiffy-worker/.env
file and see that both DIFFY_API_KEY and DIFFY_PROJECT_ID are emptyBut instead they both should be populated with values you provided during installation of the add-on.
Not that if you keep variables in your
.ddev/config.yaml
and~/.ddev/global_config.yaml
files and reinstall the add-on (ddev get --remove diffywebsite/ddev-diffy && ddev get diffywebsite/ddev-diffy
) you will get variables values populated indiffy-worker/.env
file.Video demo https://www.loom.com/share/bff2d15d3278431393415d763e656d6a
The text was updated successfully, but these errors were encountered: