From e36bbd0445a62d47843c8d9933e4a87a1c67bfa9 Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Sat, 6 Jul 2024 23:59:30 +0100 Subject: [PATCH 1/2] Allow for valid hibernate environment variables *nix systems can't have periods in their environment variable names, so we instead look for `HIBERNATE` prefixes, then lowercase and translate underscores to periods. This will allow for better compatibility with *nix systems when configuring likely sensitive hibernate values. --- src/main/java/me/kavin/piped/consts/Constants.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/kavin/piped/consts/Constants.java b/src/main/java/me/kavin/piped/consts/Constants.java index 984088f..1f08df7 100644 --- a/src/main/java/me/kavin/piped/consts/Constants.java +++ b/src/main/java/me/kavin/piped/consts/Constants.java @@ -166,8 +166,9 @@ public class Constants { S3_CLIENT = null; } System.getenv().forEach((key, value) -> { - if (key.startsWith("hibernate")) - hibernateProperties.put(key, value); + if (key.startsWith("HIBERNATE")) + String k = key.replace("_", ".").toLowerCase(); + hibernateProperties.put(k, value); }); MATRIX_SERVER = getProperty(prop, "MATRIX_SERVER", "https://matrix-client.matrix.org"); MATRIX_TOKEN = getProperty(prop, "MATRIX_TOKEN"); From 946b3762a9020746d87f70ac0bb3f123d26a92ec Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Thu, 11 Jul 2024 18:44:21 +0100 Subject: [PATCH 2/2] Hibernate environment variables double underscore to period --- src/main/java/me/kavin/piped/consts/Constants.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/me/kavin/piped/consts/Constants.java b/src/main/java/me/kavin/piped/consts/Constants.java index 1f08df7..f9ef8bf 100644 --- a/src/main/java/me/kavin/piped/consts/Constants.java +++ b/src/main/java/me/kavin/piped/consts/Constants.java @@ -167,8 +167,7 @@ public class Constants { } System.getenv().forEach((key, value) -> { if (key.startsWith("HIBERNATE")) - String k = key.replace("_", ".").toLowerCase(); - hibernateProperties.put(k, value); + hibernateProperties.put(key.replace("__", ".").toLowerCase(), value); }); MATRIX_SERVER = getProperty(prop, "MATRIX_SERVER", "https://matrix-client.matrix.org"); MATRIX_TOKEN = getProperty(prop, "MATRIX_TOKEN");