This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
				
			
		
		
		
		
			
	
	
		
			
				
					
						
							| 
									
										
										
										
											2017-03-25 14:27:47 +01:00
										 |  |  | package main | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							|  |  |  | 	"flag" | 
					
						
							|  |  |  | 	"log" | 
					
						
							| 
									
										
										
										
											2017-03-25 16:09:17 +01:00
										 |  |  | 	"net/http" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	goji "goji.io" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	http_api "github.com/genofire/hs_master-kss-monolith/http" | 
					
						
							|  |  |  | 	"github.com/genofire/hs_master-kss-monolith/models" | 
					
						
							| 
									
										
										
										
											2017-03-25 14:27:47 +01:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | var ( | 
					
						
							| 
									
										
										
										
											2017-03-25 16:09:17 +01:00
										 |  |  | 	configFile string | 
					
						
							|  |  |  | 	config     *models.Config | 
					
						
							| 
									
										
										
										
											2017-03-25 14:27:47 +01:00
										 |  |  | 	timestamps bool | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func main() { | 
					
						
							|  |  |  | 	flag.BoolVar(×tamps, "timestamps", true, "print timestamps in output") | 
					
						
							| 
									
										
										
										
											2017-03-25 16:09:17 +01:00
										 |  |  | 	flag.StringVar(&configFile, "config", "config.conf", "path of configuration file (default:config.conf)") | 
					
						
							| 
									
										
										
										
											2017-03-25 14:27:47 +01:00
										 |  |  | 	flag.Parse() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-25 16:09:17 +01:00
										 |  |  | 	// load config
 | 
					
						
							|  |  |  | 	config = models.ReadConfigFile(configFile) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-25 14:27:47 +01:00
										 |  |  | 	if !timestamps { | 
					
						
							|  |  |  | 		log.SetFlags(0) | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-03-25 16:09:17 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	log.Println("Starting rezension monolith") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Startwebsrver
 | 
					
						
							|  |  |  | 	router := goji.NewMux() | 
					
						
							|  |  |  | 	http_api.BindAPI(router) | 
					
						
							|  |  |  | 	http.ListenAndServe(config.WebserverBind, router) | 
					
						
							| 
									
										
										
										
											2017-03-25 14:27:47 +01:00
										 |  |  | } |