Description
Since Jooby 4.5: if we are using typesafe to read some configuration file before starting the jooby application, arguments passed to Jooby.runApp will no longer be visible during configuration resolution.
Jooby will internally set these args as system properties but, since Typesafe Config has already loaded and cached system properties before runApp initializes the application, it causes the args passed to runApp to be effectively ignored.
This started happening due to recent changes to Environment.systemProperties(), which will no longer pass the System.getProperties() as an argument.
To Reproduce
Java file:
public class TestIssue extends Jooby {
{
getConfig();
}
public static void main(String[] args) {
// loads some auxiliary configuration file --> "freezes" the typesafe cache
ConfigFactory.load("variables.conf");
// used to replace a placeholder on the config file
String[] newArgs = {
"bd.url=localhost"
};
// internally will load the application.conf properties
runApp(newArgs, TestIssue::new);
}
}
application.conf:
persistence.url = ${bd.url}
variables.conf:
auth_client.secret = "xxx"
Expected behavior
Arguments passed to runApp should be available as system properties, allowing for the replacement of the placeholder ${bd.url}, just as they were in previous versions.
Actual behavior
The substituion of ${bd.url} never occurs and the application throws an error on boot:
Caused by: com.typesafe.config.ConfigException$UnresolvedSubstitution: application.conf @ file:[...]/application.conf: 1: Could not resolve substitution to a value: ${bd.url}
Environment
Jooby version: 4.5.0
Java version: 21.0.10
OS: Ubuntu 24.04.4
Description
Since Jooby 4.5: if we are using typesafe to read some configuration file before starting the jooby application, arguments passed to Jooby.runApp will no longer be visible during configuration resolution.
Jooby will internally set these args as system properties but, since Typesafe Config has already loaded and cached system properties before runApp initializes the application, it causes the args passed to runApp to be effectively ignored.
This started happening due to recent changes to Environment.systemProperties(), which will no longer pass the System.getProperties() as an argument.
To Reproduce
Java file:
application.conf:
variables.conf:
Expected behavior
Arguments passed to runApp should be available as system properties, allowing for the replacement of the placeholder ${bd.url}, just as they were in previous versions.
Actual behavior
The substituion of ${bd.url} never occurs and the application throws an error on boot:
Caused by: com.typesafe.config.ConfigException$UnresolvedSubstitution: application.conf @ file:[...]/application.conf: 1: Could not resolve substitution to a value: ${bd.url}
Environment
Jooby version: 4.5.0
Java version: 21.0.10
OS: Ubuntu 24.04.4