From fd2afd72b5bd02f9886462ad07e4395c043239c9 Mon Sep 17 00:00:00 2001 From: Minecon724 <git@m724.eu> Date: Tue, 10 Sep 2024 13:01:52 +0200 Subject: [PATCH] add option for changing system username --- src/main/java/eu/m724/talkpages/Startup.java | 7 ++++++- src/main/resources/application.properties | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/m724/talkpages/Startup.java b/src/main/java/eu/m724/talkpages/Startup.java index b0ce5fa..f1212d2 100644 --- a/src/main/java/eu/m724/talkpages/Startup.java +++ b/src/main/java/eu/m724/talkpages/Startup.java @@ -9,15 +9,20 @@ import jakarta.enterprise.event.Observes; import jakarta.inject.Inject; import jakarta.inject.Singleton; import jakarta.transaction.Transactional; +import org.eclipse.microprofile.config.inject.ConfigProperty; +// TODO remove this or make it only on first run @Singleton public class Startup { @Inject LaunchMode launchMode; + @ConfigProperty(name = "talkpages.systemUser.name") + private String username; + @Transactional public void examplePage(@Observes StartupEvent ignoredEvent) { - Account account = new Account("System"); + Account account = new Account(username); account.persistAndFlush(); addPage(account, "TalkPages", "<p>A website where the users collaboratively create content</p><ul><li><a href=\"https://git.m724.eu/Minecon724/talkpages\">Source code</a></li></ul>"); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 64b3de0..6d0a85c 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1 +1,2 @@ -talkpages.homePage=/ \ No newline at end of file +talkpages.homePage=/ +talkpages.systemUser.name=System \ No newline at end of file