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.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>");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +1,2 @@
 | 
				
			||||||
talkpages.homePage=/
 | 
					talkpages.homePage=/
 | 
				
			||||||
 | 
					talkpages.systemUser.name=System
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue