mirror of
				https://github.com/osmarks/mycorrhiza.git
				synced 2025-10-31 07:33:00 +00:00 
			
		
		
		
	Add a -listen-addr flag, remove LISTEN_ADDR/PORT
This commit is contained in:
		| @@ -137,21 +137,15 @@ func ReadConfigFile(path string) error { | ||||
| 	// doesn't exist or is empty. | ||||
| 	f.MapTo(cfg) | ||||
|  | ||||
| 	if os.Getenv("LISTEN_ADDR") != "" { | ||||
| 		cfg.Network.ListenAddr = os.Getenv("LISTEN_ADDR") | ||||
| 	} | ||||
|  | ||||
| 	if os.Getenv("PORT") != "" { | ||||
| 		cfg.Network.ListenAddr = "127.0.0.1:" + os.Getenv("PORT") | ||||
| 	} | ||||
|  | ||||
| 	// Map the struct to the global variables | ||||
| 	WikiName = cfg.WikiName | ||||
| 	NaviTitleIcon = cfg.NaviTitleIcon | ||||
| 	HomeHypha = cfg.HomeHypha | ||||
| 	UserHypha = cfg.UserHypha | ||||
| 	HeaderLinksHypha = cfg.HeaderLinksHypha | ||||
| 	if ListenAddr == "" { | ||||
| 		ListenAddr = cfg.ListenAddr | ||||
| 	} | ||||
| 	URL = cfg.URL | ||||
| 	UseAuth = cfg.UseAuth | ||||
| 	AllowRegistration = cfg.AllowRegistration | ||||
|   | ||||
							
								
								
									
										1
									
								
								flag.go
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								flag.go
									
									
									
									
									
								
							| @@ -36,6 +36,7 @@ type CreateUserCommand struct { | ||||
| func parseCliArgs() { | ||||
| 	var createAdminName string | ||||
|  | ||||
| 	flag.StringVar(&cfg.ListenAddr, "listen-addr", "", "Address to listen on. For example, 127.0.0.1:1737 or /run/mycorrhiza.sock.") | ||||
| 	flag.StringVar(&createAdminName, "create-admin", "", "Create a new admin. The password will be prompted in the terminal.") | ||||
| 	flag.Usage = printHelp | ||||
| 	flag.Parse() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 handlerug
					handlerug