SHA256
Зафиксировать текущие изменения CORE/CONTENT
This commit is contained in:
@@ -29,17 +29,23 @@ public final class AppConfig {
|
||||
}
|
||||
|
||||
private void load() {
|
||||
boolean hasInternalConfig;
|
||||
try (InputStream in = getClass().getClassLoader().getResourceAsStream("application.properties")) {
|
||||
if (in == null) {
|
||||
throw new RuntimeException("Config file application.properties not found");
|
||||
hasInternalConfig = in != null;
|
||||
if (hasInternalConfig) {
|
||||
properties.load(in);
|
||||
}
|
||||
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)) {
|
||||
if (!hasInternalConfig || Files.exists(externalConfig)) {
|
||||
throw new IllegalStateException("External application.properties missing or not a regular file: "
|
||||
+ externalConfig.toAbsolutePath()
|
||||
+ "; copy application.properties.example to the server working directory");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user