diff --git a/SHiNE-server/shine-server-config/src/main/java/utils/config/AppConfig.java b/SHiNE-server/shine-server-config/src/main/java/utils/config/AppConfig.java index 00adf62..0d53fe4 100644 --- a/SHiNE-server/shine-server-config/src/main/java/utils/config/AppConfig.java +++ b/SHiNE-server/shine-server-config/src/main/java/utils/config/AppConfig.java @@ -3,6 +3,9 @@ package utils.config; import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.Properties; public final class AppConfig { @@ -26,18 +29,30 @@ public final class AppConfig { } private void load() { - try (InputStream in = getClass().getClassLoader() - .getResourceAsStream("application.properties")) { - + try (InputStream in = getClass().getClassLoader().getResourceAsStream("application.properties")) { if (in == null) { throw new RuntimeException("Config file application.properties not found"); } - properties.load(in); - } catch (IOException e) { throw new RuntimeException("Failed to load application.properties", e); } + + Path externalConfig = Paths.get("application.properties"); + if (!Files.isRegularFile(externalConfig)) { + return; + } + + Properties override = new Properties(); + try (InputStream in = Files.newInputStream(externalConfig)) { + override.load(in); + } catch (IOException e) { + throw new RuntimeException("Failed to load external application.properties from " + externalConfig.toAbsolutePath(), e); + } + + for (String name : override.stringPropertyNames()) { + properties.setProperty(name, override.getProperty(name)); + } } /** Вернёт значение строки или null, если параметр не найден */ diff --git a/VERSION.properties b/VERSION.properties index 98b7f68..de131e3 100644 --- a/VERSION.properties +++ b/VERSION.properties @@ -1,2 +1,2 @@ -client.version=1.2.271 -server.version=1.2.251 +client.version=1.2.272 +server.version=1.2.252