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
DS-4189 Enhance configuration by environment variables #2373
Conversation
Unfortunately this cannot be backported as it requires Apache Commons Configuration 2 which is available as of DSpace 7. |
I will give this a test and report my results. I have a couple initial comments. If this could not be implemented in DSpace 6, I presume we will use another technique (probably sed ... > local.cfg) for DSpace 6. We can introduce different initialization scripts for each version of DSpace. We have at least one variable that uses camel case |
...-services/src/main/java/org/dspace/servicemanager/config/DSpaceEnvironmentConfiguration.java
Show resolved
Hide resolved
...-services/src/main/java/org/dspace/servicemanager/config/DSpaceEnvironmentConfiguration.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from the lower-case issue I mentioned, this code looks good. I think this is the optimal approach for passing there properties into a container.
I tested locally and the changes work as expected.
For the earlier branches (DSpace 6, etc), we will implement a less-optimal solution for Docker purposes.
I‘ll change this to be case sensitive. That is an easy task. |
Fyi... I propose the following changes to our docker compose repo to accompany this change. |
4533ad2
to
1975014
Compare
@terrywbrady @tdonohue I made the changes requested. The configuration now works case sensitive. I tested it with dspace.baseURL and dspace.baseUrl and dspace.name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since my last review, I discovered that we also need a mechanism to set properties containing a dash. I was attempting to set sword-server.enabled=true
and I discovered a similar issue to the one we discovered with periods.
I propose that we map __dash__
to -
.
I would be open to a different mapping.
The following PR illustrates why this additional enhancement will be needed.
The code here is looking good overall. Since @terrywbrady points out there are additional problem characters, we may want to come up with a more standard replacement strategy (which could cover other problem characters, if any arise). So, as suggested by @terrywbrady , we could consider a standard replacement format like:
As-is, this PR is definitely specific to Apache Commons Configuration v2, as it relies on the concept of |
I'm not a friend of so long environment variable names: |
I do not think we should rename properties. I think we should keep the property names constant across DSpace versions I agree that my first proposal would create long keys. We could go with |
Just a quick note. I agree here with @terrywbrady. I don't think we should rename properties to please Docker. I'd rather we come up with a reasonable replacement strategy. While I definitely understand the desire to keep environment variables short, I think we also need to consider the fact that many (most?) people using Docker may not even use these environment variables (beyond the default ones pre-set for them to initialize their Docker environment). So, readability/length of the environment variables may not be a major concern if most users are not even aware of them. |
We had a quick chat on Slack and decided to go with the following replacement code for consistency.
|
I have applied changes addressing my prior review
Output to demonstrate that the change is in place
|
@tdonohue , @mwoodiupui , @pnbecker , could you give this a quick review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Overall, this looks good. One minor inline note below about correcting an inline comment to better document the behavior of the new dspaceenv
tag in config-definition.xml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 by inspection.
https://jira.duraspace.org/browse/DS-4189
To test: