process jpa properties set as env variables (#808)
* process jpa properties set as env variables * Update src/main/java/ca/uhn/fhir/jpa/starter/util/EnvironmentHelper.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Jens Kristian Villadsen <jenskristianvilladsen@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -40,6 +40,19 @@ public class EnvironmentHelper {
|
|||||||
properties.put(strippedKey, entry.getValue().toString());
|
properties.put(strippedKey, entry.getValue().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// also check for JPA properties set as environment variables, this is slightly hacky and doesn't cover all
|
||||||
|
// the naming conventions Springboot allows
|
||||||
|
// but there doesn't seem to be a better/deterministic way to get these properties when they are set as ENV
|
||||||
|
// variables and this at least provides
|
||||||
|
// a way to set them (in a docker container, for instance)
|
||||||
|
Map<String, Object> jpaPropsEnv = getPropertiesStartingWith(environment, "SPRING_JPA_PROPERTIES");
|
||||||
|
for (Map.Entry<String, Object> entry : jpaPropsEnv.entrySet()) {
|
||||||
|
String strippedKey = entry.getKey().replace("SPRING_JPA_PROPERTIES_", "");
|
||||||
|
strippedKey = strippedKey.replaceAll("_", ".");
|
||||||
|
strippedKey = strippedKey.toLowerCase();
|
||||||
|
properties.put(strippedKey, entry.getValue().toString());
|
||||||
|
}
|
||||||
|
|
||||||
// Spring Boot Autoconfiguration defaults
|
// Spring Boot Autoconfiguration defaults
|
||||||
properties.putIfAbsent(AvailableSettings.SCANNER, "org.hibernate.boot.archive.scan.internal.DisabledScanner");
|
properties.putIfAbsent(AvailableSettings.SCANNER, "org.hibernate.boot.archive.scan.internal.DisabledScanner");
|
||||||
properties.putIfAbsent(
|
properties.putIfAbsent(
|
||||||
|
|||||||
Reference in New Issue
Block a user