From 3691349d8b34d0daeaca5c28814f02a75011b58a 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 2a2624d..9e34380 100644 --- a/src/main/java/me/kavin/piped/consts/Constants.java +++ b/src/main/java/me/kavin/piped/consts/Constants.java @@ -164,8 +164,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 643d7ad4d55cbfeb7c2759f76dd666aabf76b07b 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 9e34380..e785277 100644 --- a/src/main/java/me/kavin/piped/consts/Constants.java +++ b/src/main/java/me/kavin/piped/consts/Constants.java @@ -165,8 +165,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");