Skip to content
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

feat(props): Add support to overwrite properties based on a UP_CLUSTE… #1763

Merged
merged 2 commits into from Jun 27, 2019

Conversation

bjagg
Copy link
Member

@bjagg bjagg commented Jun 27, 2019

…R env property

Resolves #1747

Checklist
Description of change

Client wished to place all properties in a single set of properties files that would work in test, and prod. To support this, a system environment variable UP_CLUSTER can be set. If properties are found that start with that value plus ., then those key/value pairs will be added back, overwriting existing values, without the prefix.

For example if UP_CLUSTER=prod is set in the System environment, an initial properties set of:

url=www.github.com
dev.url=github.com
prod.url=www.mycompany.com

will then become the following, post-processed:

url=www.mycompany.com
dev.url=github.com
prod.url=www.mycompany.com

Also, -Dcluster=prod added to CATALINA_OPTS, JAVA_OPTS, etc. will also work.

N.B. UP_CLUSTER takes precedent over the -Dcluster JVM argument.

@bjagg bjagg added the enhancement Improvement label Jun 27, 2019
@bjagg bjagg added this to the 5.6.1 milestone Jun 27, 2019
@bjagg bjagg self-assigned this Jun 27, 2019
@ChristianMurphy
Copy link
Member

Do we want to do this per property?
Or would it be better to generalize this to have different properties files for different envs, so multiple properties can be customized?

@bjagg
Copy link
Member Author

bjagg commented Jun 27, 2019

Do we want to do this per property?
Or would it be better to generalize this to have different properties files for different envs, so multiple properties can be customized?

Before this PR, different properties files was the only option. Thus, Ops folks would have a separate uPortal.properties, global.properties, notifications.properties, etc. for each environment. This is still a good practice.

This PR is a convenience enhancement that will allow all those versions of a same file to be brought back into a single file while still supporting multiple environments.

@bjagg bjagg merged commit fb7cb7a into uPortal-Project:master Jun 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance properties loader class to honor env prefixes
2 participants