reverse from pull 330
This commit is contained in:
		
							parent
							
								
									3c91360d72
								
							
						
					
					
						commit
						fb6312a303
					
				
							
								
								
									
										10
									
								
								beego.go
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								beego.go
									
									
									
									
									
								
							| @ -67,7 +67,15 @@ func InsertFilter(pattern string, pos int, filter FilterFunc) *App { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func Run() { | func Run() { | ||||||
| 	InitConfig() | 	//if AppConfigPath not In the conf/app.conf reParse config | ||||||
|  | 	if AppConfigPath != path.Join(AppPath, "conf", "app.conf") { | ||||||
|  | 		err := ParseConfig() | ||||||
|  | 		if err != nil { | ||||||
|  | 			if RunMode == "dev" { | ||||||
|  | 				Warn(err) | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	if SessionOn { | 	if SessionOn { | ||||||
| 		GlobalSessions, _ = session.NewManager(SessionProvider, | 		GlobalSessions, _ = session.NewManager(SessionProvider, | ||||||
|  | |||||||
							
								
								
									
										21
									
								
								config.go
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								config.go
									
									
									
									
									
								
							| @ -58,9 +58,9 @@ var ( | |||||||
| 	AdminHttpPort         int | 	AdminHttpPort         int | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| func InitConfig() { | func init() { | ||||||
| 	// explicit call config.Init |  | ||||||
| 	os.Chdir(path.Dir(os.Args[0])) | 	os.Chdir(path.Dir(os.Args[0])) | ||||||
|  | 	BeeApp = NewApp() | ||||||
| 	AppPath = path.Dir(os.Args[0]) | 	AppPath = path.Dir(os.Args[0]) | ||||||
| 	StaticDir = make(map[string]string) | 	StaticDir = make(map[string]string) | ||||||
| 	TemplateCache = make(map[string]*template.Template) | 	TemplateCache = make(map[string]*template.Template) | ||||||
| @ -83,6 +83,7 @@ func InitConfig() { | |||||||
| 	MaxMemory = 1 << 26 //64MB | 	MaxMemory = 1 << 26 //64MB | ||||||
| 	EnableGzip = false | 	EnableGzip = false | ||||||
| 	StaticDir["/static"] = "static" | 	StaticDir["/static"] = "static" | ||||||
|  | 	AppConfigPath = path.Join(AppPath, "conf", "app.conf") | ||||||
| 	HttpServerTimeOut = 0 | 	HttpServerTimeOut = 0 | ||||||
| 	ErrorsShow = true | 	ErrorsShow = true | ||||||
| 	XSRFKEY = "beegoxsrf" | 	XSRFKEY = "beegoxsrf" | ||||||
| @ -93,17 +94,7 @@ func InitConfig() { | |||||||
| 	EnableAdmin = true | 	EnableAdmin = true | ||||||
| 	AdminHttpAddr = "localhost" | 	AdminHttpAddr = "localhost" | ||||||
| 	AdminHttpPort = 8088 | 	AdminHttpPort = 8088 | ||||||
| 
 | 	ParseConfig() | ||||||
| 	// if AppConfigPath hasn't been set yet, |  | ||||||
| 	// use /Path/to/AppPath/conf/app.conf as the default |  | ||||||
| 	if AppConfigPath == "" { |  | ||||||
| 		AppConfigPath = path.Join(AppPath, "conf", "app.conf") |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	if err := ParseConfig(); err != nil { |  | ||||||
| 		panic(err) |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	runtime.GOMAXPROCS(runtime.NumCPU()) | 	runtime.GOMAXPROCS(runtime.NumCPU()) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -267,7 +258,3 @@ func ParseConfig() (err error) { | |||||||
| 	} | 	} | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| 
 |  | ||||||
| func init() { |  | ||||||
| 	BeeApp = NewApp() |  | ||||||
| } |  | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user