diff --git a/src/main/java/swiss/fihlon/apus/configuration/Mastodon.java b/src/main/java/swiss/fihlon/apus/configuration/Mastodon.java index abecdf3..4981fb0 100644 --- a/src/main/java/swiss/fihlon/apus/configuration/Mastodon.java +++ b/src/main/java/swiss/fihlon/apus/configuration/Mastodon.java @@ -17,4 +17,4 @@ */ package swiss.fihlon.apus.configuration; -public record Mastodon(String hashtag) { } +public record Mastodon(String instance, String hashtag) { } diff --git a/src/main/java/swiss/fihlon/apus/service/SocialService.java b/src/main/java/swiss/fihlon/apus/service/SocialService.java index 4f89d68..8f07c41 100644 --- a/src/main/java/swiss/fihlon/apus/service/SocialService.java +++ b/src/main/java/swiss/fihlon/apus/service/SocialService.java @@ -43,7 +43,7 @@ public final class SocialService { public SocialService(@NotNull final TaskScheduler taskScheduler, @NotNull final Configuration configuration) { hashtag = configuration.getMastodon().hashtag(); - mastodonAPI = new MastodonAPI("ijug.social"); + mastodonAPI = new MastodonAPI(configuration.getMastodon().instance()); updateMessages(); updateScheduler = taskScheduler.scheduleAtFixedRate(this::updateMessages, UPDATE_FREQUENCY); } diff --git a/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/src/main/resources/META-INF/additional-spring-configuration-metadata.json index d3d8a5a..fba4fc6 100644 --- a/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -1,8 +1,13 @@ { - "properties": [ + "properties" : [ { - "name": "apus.mastodon.hashtag", - "type": "java.lang.String", - "description": "The hashtag for the mastodon wall." - } -] } + "name" : "apus.mastodon.instance", + "type" : "java.lang.String", + "description" : "The Mastodon instance used to read the posts from." + }, + { + "name" : "apus.mastodon.hashtag", + "type" : "java.lang.String", + "description" : "The hashtag for the Mastodon wall." + } + ] } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index a82aaba..d20e44f 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -9,4 +9,5 @@ vaadin.launch-browser=false vaadin.frontend.hotdeploy=true apus.version=@project.version@ +apus.mastodon.instance=${MASTODON_INSTANCE:mastodon.social} apus.mastodon.hashtag=${MASTODON_HASHTAG:java}