mirror of
				https://github.com/yangjian102621/geekai.git
				synced 2025-11-04 08:13:43 +08:00 
			
		
		
		
	opt: 优化启动参数接收处理
This commit is contained in:
		@@ -108,6 +108,7 @@ func sessionMiddleware(config *types.AppConfig) gin.HandlerFunc {
 | 
			
		||||
		store = cookie.NewStore([]byte(config.Session.SecretKey))
 | 
			
		||||
		break
 | 
			
		||||
	default:
 | 
			
		||||
		config.Session.Driver = types.SessionDriverCookie
 | 
			
		||||
		store = cookie.NewStore([]byte(config.Session.SecretKey))
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,16 @@ func (l *AppLifecycle) OnStop(context.Context) error {
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	configFile := os.Getenv("CONFIG_FILE")
 | 
			
		||||
	debug, _ := strconv.ParseBool(os.Getenv("DEBUG"))
 | 
			
		||||
	if configFile == "" {
 | 
			
		||||
		configFile = "config.toml"
 | 
			
		||||
	}
 | 
			
		||||
	var debug bool
 | 
			
		||||
	debugEnv := os.Getenv("DEBUG")
 | 
			
		||||
	if debugEnv == "" {
 | 
			
		||||
		debug = true
 | 
			
		||||
	} else {
 | 
			
		||||
		debug, _ = strconv.ParseBool(os.Getenv("DEBUG"))
 | 
			
		||||
	}
 | 
			
		||||
	logger.Info("Loading config file: ", configFile)
 | 
			
		||||
	defer func() {
 | 
			
		||||
		if err := recover(); err != nil {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user