add option for changing system username
This commit is contained in:
		
					parent
					
						
							
								f785976fca
							
						
					
				
			
			
				commit
				
					
						fd2afd72b5
					
				
			
		
					 2 changed files with 8 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -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>");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +1,2 @@
 | 
			
		|||
talkpages.homePage=/
 | 
			
		||||
talkpages.systemUser.name=System
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue