Environment variables should be capitalized
Issue Summary
When using secrets manager like https://www.doppler.com/ the ENV variables are always enforced to be uppercase. It's always best practice to uppercase env variables to ensure compatibility across different shells.
Steps to Reproduce
Try to set uppercase env variable and it does not work.
Ghost Version
5.94
Node.js Version
20
How did you install Ghost?
Docker
Database type
MySQL 8
Browser & OS version
No response
Relevant log / error output
No response
Code of Conduct
- [X] I agree to be friendly and polite to people in this repository
Hey adityapatadia, thanks for raising the issue.
So that I understand your use case better, can you give an example of an env. variable that you'd like to set to uppercase?
I meant any config that can be set with ENV variable. Take this example database__connection__password. If this is uppercase, Ghost does not recognise it. Ideally it should be possible.
Got it, thank you for clarifying!
I would consider this a bug in Doppler rather than Ghost.
While it's a convention that env vars are upper case, it's not a requirement.
It's always best practice to uppercase env variables to ensure compatibility across different shells.
And this assertion is false. No common shells or tools have a problem with env vars not being upper case.
The format of Ghost environment variables serve a specific purpose to map exactly to the names of valid values in Ghost's config file.
There is already complexity in the system by supporting both the JSON config configuration and the environment variables that match exactly.
Supporting another format of environment variables adds unnecessary complexity.
I suggest filing a bug with Doppler instead. They are failing to support valid environment variables.
It's really impossible to set JSON config in container environments. ENV variables are the only option. Anyway it's a request to consider this.
@adityapatadia may be you can try out this in your Dockerfile
environment:
database__connection__host: ${DB_HOST} # Use Doppler's uppercase
database__connection__user: ${DB_USER}
Sounds like a good idea but problem is doppler injects variables on RUN command and not before. Any idea if that would work in some way?
Hello @adityapatadia i would like to work upon this issue.Please assign it to me.
This isn't really a bug, but I do accept it would be more convenient if uppercase env vars were supported.
The full context for why it is not supported lives in the nconf repo here - essentially, their implementation causes a jump in memory usag, which needs to be solved first.
If the issue in nconf is resolved, we can update Ghost and tweak the configuration if needed to support it.
Anyone can work on this - we don't assign issues outside of our regular contributors.
Our bot has automatically marked this issue as stale because there has not been any activity here in some time.
The issue will be closed soon if there are no further updates, however we ask that you do not post comments to keep the issue open if you are not actively working on a PR.
We keep the issue list minimal so we can keep focus on the most pressing issues. Closed issues can always be reopened if a new contributor is found. Thank you for understanding 🙂