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
🐛 Bug Report: Environment APP_CONFIG_ variables including hyphens are not valid identifiers #24716
Comments
Not entirely unrelated, but my team is also very confused as to why this behavior started occurring after the upgrade... 😅 |
I suggest variable naming in app-config should stick to camelCase. Suggestion like using __ is too patchy propose for new name can be upgradeInsecureRequests. Also would be good to enforce a case for other configuration as well to prevent issues from coming up. |
I would prefer camelCase, too, tbh, but I suggested double underscores as a convention to prevent from breaking existing configs, and also because I wasn't sure if it was possible/how to enforce that for plugins–they should also theoretically be able to have their config options overridden by env vars. |
yeah probably we should enforce the usage of camelCase in app-config in general. |
thanks for reporting this @jvanalstyne-mdsol, opened #24723 which should fix your issue |
Thank you @vinzscam!!! |
📜 Description
Setting an
APP_CONFIG_
environment variable that includes hyphens in the name is not permitted by the shell. However, some backstage app config options use kebab case and include hyphens in the names, and are therefore unable to be overridden byAPP_CONFIG_
environment variables.👍 Expected behavior
Setting an
APP_CONFIG_
env variable should have the same effect as setting the option inapp-config.yaml
. For example, if the following works in yaml:I should be able to effectively do this (or similar) in my .env file to achieve the same effect*:
*Given that shell variables generally only allow alphanumerics and underscores, alternative formatting may be necessary, such as using double underscores in place of hyphens:
APP_CONFIG_backend_csp_upgrade__insecure__requests
👎 Actual Behavior with Screenshots
In my particular case, including the following line in my local .env:
will produce the following error on start:
.env: line 99: export: `APP_CONFIG_backend_csp_upgrade-insecure-requests="false"': not a valid identifier
The error itself seems to be caused by shell variables not accepting hyphens in the name, however, as mentioned above, this prevents a developer from using environment variables to configure some backstage app config options.
👟 Reproduction steps
APP_CONFIG_
variable in your .env that includes an option with a hyphen in its name, such asAPP_CONFIG_backend_csp_upgrade-insecure-requests
📃 Provide the context for the Bug.
After upgrading from 1.24.2 to 1.26.5, our testing workflow has broken due to not being able to access a containerized instance of the service using insecure http. I found this workaround which seems to resolve the issue when modifying the
app-config.yaml
directly, but because of our testing workflows, we want to avoid having anapp-config.local.yaml
in the container, and would prefer to use an .env variable (which we would set in a docker-compose file).🖥️ Your Environment
👀 Have you spent some time to check if this bug has been raised before?
🏢 Have you read the Code of Conduct?
Are you willing to submit PR?
Yes I am willing to submit a PR!
The text was updated successfully, but these errors were encountered: