From 58553c693219ae35da7e8ea836512249fe3e7023 Mon Sep 17 00:00:00 2001 From: Ryan Harg Date: Fri, 29 Nov 2024 10:12:48 +0100 Subject: [PATCH] Config property for config file path --- README.md | 1 + src/main/java/de/rpr/ddnsclient/AppConfig.java | 7 +++++-- src/main/resources/application.properties | 3 +-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a26bcb2..e2bac74 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ ddnssclient can also be configured using some properties or environment variable | ddnsclient.ip-provider | DDNSCLIENT_IP_PROVIDER | an ip lookup provider (see below) | null (random) | | ddnsclient.dns.resolver | DDNSCLIENT_DNS_RESOLVER | e.g. "9.9.9.9", "1.1.1.1" | "9.9.9.9" | | ddnsclient.backoff-duration | DDNSCLIENT_BACKOFF_DURATION | e.g. "60s", "1m" | "300s" | +| ddnssclient.config-file | DDNSCLIENT_CONFIG_FILE | e.g. "/path/to/your/config.json" | "config.json" | ## IP lookup diff --git a/src/main/java/de/rpr/ddnsclient/AppConfig.java b/src/main/java/de/rpr/ddnsclient/AppConfig.java index 0fd4877..46beb1c 100644 --- a/src/main/java/de/rpr/ddnsclient/AppConfig.java +++ b/src/main/java/de/rpr/ddnsclient/AppConfig.java @@ -19,8 +19,11 @@ public class AppConfig { @Produces @ApplicationScoped - public Config config(ObjectMapper objectMapper) throws IOException { - File configFile = new File("config.json"); + public Config config( + ObjectMapper objectMapper, + @ConfigProperty(name = "ddnsclient.config-file", defaultValue = "config.json") String configFilePath) + throws IOException { + File configFile = new File(configFilePath); return objectMapper.readValue(configFile, Config.class); } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index b6dd53c..79c37e4 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,4 +1,3 @@ quarkus.log.level=INFO quarkus.log.category."de.rpr.ddnsclient".min-level=TRACE -quarkus.log.category."de.rpr.ddnsclient".level=INFO - +quarkus.log.category."de.rpr.ddnsclient".level=INFO \ No newline at end of file