From f3e4233285c62c1246fb2d4a3bad119cdf3d417ee19a44efc740d45ed6eef3eb Mon Sep 17 00:00:00 2001 From: AidarKC Date: Thu, 25 Jun 2026 18:04:04 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D1=83?= =?UTF-8?q?=20=D0=B2=D0=BD=D0=B5=D1=88=D0=BD=D0=B5=D0=B3=D0=BE=20applicati?= =?UTF-8?q?on.properties?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/utils/config/AppConfig.java | 25 +++++++++++++++---- VERSION.properties | 4 +-- 2 files changed, 22 insertions(+), 7 deletions(-) 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