Load mirth.properties.d drop-in configuration overrides on startup - #405
Load mirth.properties.d drop-in configuration overrides on startup#405pacmano1 wants to merge 3 commits into
Conversation
Files named *.properties under conf/mirth.properties.d are applied on top of mirth.properties in lexical filename order, later files winning. The server never writes to the directory: migration and password re-encryption operate on a separate file-backed configuration, so drop-in values are never baked into mirth.properties. Signed-off-by: Finnegan's Owner <44065187+pacmano1@users.noreply.github.com>
Test Results683 tests 683 ✅ 2m 12s ⏱️ Results for commit 0a23598. ♻️ This comment has been updated with latest results. |
Replaces the README: the sample carries the documentation as comments and is ignored by the loader until copied to a *.properties name. Also corrects the mirth.properties header comment - the server does not rewrite this file in normal operation; the drop-in directory exists for upgrade hygiene. Signed-off-by: Finnegan's Owner <44065187+pacmano1@users.noreply.github.com>
|
Design notes, so the reasoning doesn't live only in my head:
|
mgaffigan
left a comment
There was a problem hiding this comment.
Can we collapse this to a global store? Each consumer should not have to construct this themselves, nor should we be reading it so many times during boot and operation without reason.
Also also: if we're doing this, can we sneak in or at least leave room for configuration via environment variables taking precedence over everything?
|
Both good. Store: agreed. Env: reading this as the Docker path. |
Add ConfigurationController.getPropertiesConfiguration(), which returns mirth.properties with the conf/mirth.properties.d drop-ins already applied. Mirth and WebStartServlet now read that single shared copy instead of each loading and merging the file themselves. The returned configuration is owned by the controller and must be treated as read-only; the controller writes to it during startup (for example when it generates keystore passwords), and consumers only read it. A drop-in file that cannot be read or parsed now fails closed. Previously overlay() threw during controller initialization, where the exception was swallowed and the server came up on the base configuration with the drop-ins silently dropped; if a drop-in was hardening a setting, that reverts to the weaker base value. Catch the failure, record it, and refuse to start with a clear message. The launcher's early readers stay lenient and skip a bad file with a warning, matching how they already treat mirth.properties. A malformed \uXXXX escape is treated the same as an unreadable file. Add a regression test that a write to the merged configuration does not leak back into the base file saved to mirth.properties. Signed-off-by: Finnegan's Owner <44065187+pacmano1@users.noreply.github.com>
|
Consolidated config loading. A bad drop-in file now fails closed. Two cases:
Also documented that Verified: full |
|
Heads up on CI: the |
Closes #50.
Files named
*.propertiesunderconf/mirth.properties.dare loaded on top ofmirth.propertiesat startup, in lexical filename order, later files winning. The server never writes to the directory, so local configuration survives upgrades without hand-merging. This mirrors the existing vmoptions convention (base_includes.vmoptions->custom.vmoptions).All six
mirth.propertiesreaders apply the overlay: the launcher, the main server, the configuration controller, the WebStart servlet, extension statuses, and the Rhino optimization-level lookup inJavaScriptScopeUtil. The configuration controller keeps a separate file-backed config for version migration and password re-encryption, so those writes never bake drop-in values intomirth.properties.Scope notes:
database.password, keystore passwords) should stay inmirth.properties; a plaintext override in a drop-in keeps taking precedence and is never encrypted. Documented in the shipped mirth.properties.example.migrateKeystore()still readsmirth.propertiesdirectly; it's a one-shot legacy migration (pre-2.2) and was left alone.mirth.properties(also floated in [IDEA] Allow multiple MC configuration files t be read on startup #50) belongs to the existing branding effort (Alter the build pipeline so that build artifacts are branded as "openintegrationengine" or "oie" instead of "mirth" #165, Standardize artifact naming to align with project branding #220) rather than this PR.To verify: create
conf/mirth.properties.d/10-test.propertiescontaininghttp.port = 8199, start the server viaoieserver, confirm the startup log reports the web server on port 8199 and thatconf/mirth.propertiesis unchanged afterward.