-
Notifications
You must be signed in to change notification settings - Fork 635
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
Environment Variable name look-up #1274
Comments
I totally agree with you and we are in the process to convert some variables. The first step is to convert some secrets and passwords. Let us know what else we need to convert. Here is an example we are doing. |
Hi @stevehu , Its good to see you start the process of updating the default variable names. :) However -- just to make sure we're on the same page -- we are not proposing changing the default variable names in this issue (though we think that's a good idea). What we are proposing in this issue would actually allow light-4j to keep the existing variable names, but have light-4j dynamically change the names to a legal env-var format whenever it tries to find that value in the environment. For example: This would allow light-4j to continue to use the variable name client.keyStore in the default config files... However, in the case that light-4j needs to get the value of client.keyStore from an environment variable, it would look for the value of CLIENT_KEYSTORE rather than client.keyStore. It would automatically do this name conversion (client.keyStore -> CLIENT_KEYSTORE) at runtime, and it would only do this name conversion when it attempts to get the value from the environment. |
E.g.: Something like this ... = System.getenv(toLegalEnvVarFormat(externalVarName)); |
@miklish I think that is a good idea. It allows us to have unified externalized config files without figuring out which fields would be possible to be overwritten by the env vars. I am wondering if you could submit a PR to get it implemented. |
Hi Steve, Yes we are going to submit a PR for this to get implemented. |
#1357) * Changes made to the code as per the requirements mentioned in Issue #1274 & Issue #1287 * Changes made to the code as per the requirements mentioned in Issue #1274 & Issue #1287 * Made a static object for Decryptor to be used in the class since while starting the service it was creating multiple instances of the decryptor. Co-authored-by: Akash <[email protected]>
#1357) * Changes made to the code as per the requirements mentioned in Issue #1274 & Issue #1287 * Changes made to the code as per the requirements mentioned in Issue #1274 & Issue #1287 * Made a static object for Decryptor to be used in the class since while starting the service it was creating multiple instances of the decryptor. Co-authored-by: Akash <[email protected]>
This issue has been completed on both 1.6.0 and 2.0.0 branches. |
… & networknt#1287 (networknt#1357) * Changes made to the code as per the requirements mentioned in Issue networknt#1274 & Issue networknt#1287 * Changes made to the code as per the requirements mentioned in Issue networknt#1274 & Issue networknt#1287 * Made a static object for Decryptor to be used in the class since while starting the service it was creating multiple instances of the decryptor. Co-authored-by: Akash <[email protected]>
Issue:
If light-4j is configured to pull a variable value from the environment, and the variable does not have a legal env-var name (e.g.: the token is my.server.ip), then light-4j will be unable to get any value for that variable.
Proposed Feature/Update:
In cases where a value comes from the environment, we want light-4j to convert the variable name to a legal env-var name before trying to find the value (e.g.: look for the env-var named MY_SERVER_IP instead of my.server.ip).
So this new feature will remove any alpha-numeric values from the naming convention and replace the "." with an "_" and then converting it to uppercase.
This behaviour is similar to functionality found in frameworks such as Spring.
The text was updated successfully, but these errors were encountered: