add option for changing system username

This commit is contained in:
Minecon724 2024-09-10 13:01:52 +02:00
parent f785976fca
commit fd2afd72b5
Signed by: Minecon724
GPG key ID: 3CCC4D267742C8E8
2 changed files with 8 additions and 2 deletions

View file

@ -9,15 +9,20 @@ import jakarta.enterprise.event.Observes;
import jakarta.inject.Inject; import jakarta.inject.Inject;
import jakarta.inject.Singleton; import jakarta.inject.Singleton;
import jakarta.transaction.Transactional; import jakarta.transaction.Transactional;
import org.eclipse.microprofile.config.inject.ConfigProperty;
// TODO remove this or make it only on first run
@Singleton @Singleton
public class Startup { public class Startup {
@Inject @Inject
LaunchMode launchMode; LaunchMode launchMode;
@ConfigProperty(name = "talkpages.systemUser.name")
private String username;
@Transactional @Transactional
public void examplePage(@Observes StartupEvent ignoredEvent) { public void examplePage(@Observes StartupEvent ignoredEvent) {
Account account = new Account("System"); Account account = new Account(username);
account.persistAndFlush(); 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>"); 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>");

View file

@ -1 +1,2 @@
talkpages.homePage=/ talkpages.homePage=/
talkpages.systemUser.name=System