carbon-kernel
carbon-kernel copied to clipboard
The carbon.properties file are loaded before the toml configuration applied
Description: Currently, in the Bootstrap[1] carbon.properties are loaded to the system. But the deployment.toml configurations are applied in the Main[2] which will be executed after system properties are added in [1].
We allow updating the carbon.properties file through the deployment.toml. But due to the above behaviour, those properties defined through deployment.toml will not be applied in the first server startup. It will be applied only after the next restart.
It seems like a bug. To fix this, we can bring the config-mapper invocation to the Bootstrap. This will guarantee that any change we do to configuration files are available to the server.
[1] - https://github.com/wso2-support/carbon4-kernel/blob/support-4.5.1/core/org.wso2.carbon.bootstrap/src/main/java/org/wso2/carbon/bootstrap/Bootstrap.java#L56 [2] - https://github.com/wso2-support/carbon4-kernel/blob/support-4.5.1/core/org.wso2.carbon.server/src/main/java/org/wso2/carbon/server/Main.java#L103
we have a concern in this approach because in the config-mapping we can have $sys() do load the system properties. So we can't move the config-mapper invocation before loading the system properties from the carbon.properties.
we need to check the possibility of having the system properties in the deployment.toml and config-mapper have to load those properties to the system and then we can remove the carbon.properties file.