Move starting #server function
This commit is contained in:
		
							parent
							
								
									69497c77e4
								
							
						
					
					
						commit
						17c8b0fa88
					
				
							
								
								
									
										9
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								main.go
									
									
									
									
									
								
							| @ -1,8 +1,6 @@ | |||||||
| package main | package main | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"fmt" |  | ||||||
| 	"net/http" |  | ||||||
| 	"os" | 	"os" | ||||||
| 	"os/signal" | 	"os/signal" | ||||||
| 	"syscall" | 	"syscall" | ||||||
| @ -37,10 +35,5 @@ func main() { | |||||||
| 	HandleShutdown() | 	HandleShutdown() | ||||||
| 	LoadState() | 	LoadState() | ||||||
| 	go KeepStatePersisted() | 	go KeepStatePersisted() | ||||||
| 
 | 	StartServer() | ||||||
| 	port := fmt.Sprintf(":%d", Config.Port) |  | ||||||
| 	err := http.ListenAndServe(port, nil) |  | ||||||
| 	if err != nil { |  | ||||||
| 		Error(err, "Error starting server on port %d", Config.Port) |  | ||||||
| 	} |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -8,6 +8,14 @@ import ( | |||||||
| 	"strings" | 	"strings" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
|  | func StartServer() { | ||||||
|  | 	port := fmt.Sprintf(":%d", Config.Port) | ||||||
|  | 	err := http.ListenAndServe(port, nil) | ||||||
|  | 	if err != nil { | ||||||
|  | 		Error(err, "Error starting server on port %d", Config.Port) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func StatusHandler(w http.ResponseWriter, r *http.Request) { | func StatusHandler(w http.ResponseWriter, r *http.Request) { | ||||||
| 	info := make(map[string]map[string]uint) | 	info := make(map[string]map[string]uint) | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user