Developer Documentation: Configuration Initializer
Version:
Date: 2024-09-25
Author: Caleb Steele-Lane
1. Introduction
1.1 Feature Overview
Allows the setting and changing of basic OpenELIS-Global configuration options at startup via property files.
1.2 Audience
Developers that need an understanding of how the Configuration Initializer works
2. Technical Specifications
2.1 Expected Behaviour
2.1.1 Configuration Override Order (lowest priority to highest priority)
Default value in code
Default property file (
src/main/resources/SystemConfiguration.properties
)Database value (at startup time)
Total property file (
/var/lib/openelis-global/properties/TotalSystemConfiguration.properties
)Change property file (
/var/lib/openelis-global/properties/SystemConfiguration.properties
)Runtime updates in Admin Section
2.1.2 Values Stored
The values that get stored are all the enum values in ConfigurationProperties.Property
along with all the values that already existed in src/main/resources/SystemConfiguration.properties
and the values in the site_information
table (using site_information.name
as a property name).
2.1.3 Value Storage
All values get stored in the “Total property file” (/var/lib/openelis-global/properties/TotalSystemConfiguration.properties
) once startup has completed. If a site_information
entry also exists with the same name, it will also be stored there. This means that at startup, the Configuration Override Order is used when reading the values. Once all sources have been read from, the values are persisted to the Total property file, overwriting any values that were there and the values are also written to the database. The “Change property file “ is then moved from it’s location to /var/lib/openelis-global/properties/ChangedSystemConfiguration.properties
in the docker container to maintain the properties that have been changed via this method.
2.2 API Specifications
2.2.1 Endpoints
TODO
Endpoint: [URL]
Method: [GET/POST/PUT/DELETE]
Description: [Brief description]
Request Parameters:
[Parameter Name] (Type, Required/Optional, Description)
Response Format:
[Description of the response structure]
3. Code Implementation
3.1 Directory Structure
OpenELIS standard directory structure
3.2 Key Files
3.2.1 Java Classes
org.openelisglobal.common.util.ConfigurationProperties.java
org.openelisglobal.common.util.DefaultConfigurationProperties.java
org.openelisglobal.config.ApConfig.java
3.2.2 Java Resource Files
SystemConfiguration.properties
3.2.3 System Files (In docker container)
/var/lib/openelis-global/properties/SystemConfiguration.properties
/var/lib/openelis-global/properties/ChangedSystemConfiguration.properties
/var/lib/openelis-global/properties/TotalSystemConfiguration.properties