mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-18 01:06:39 +08:00
opt: 优化启动参数接收处理
This commit is contained in:
parent
daf83cfc84
commit
6c65a21692
@ -108,6 +108,7 @@ func sessionMiddleware(config *types.AppConfig) gin.HandlerFunc {
|
|||||||
store = cookie.NewStore([]byte(config.Session.SecretKey))
|
store = cookie.NewStore([]byte(config.Session.SecretKey))
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
|
config.Session.Driver = types.SessionDriverCookie
|
||||||
store = cookie.NewStore([]byte(config.Session.SecretKey))
|
store = cookie.NewStore([]byte(config.Session.SecretKey))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,16 @@ func (l *AppLifecycle) OnStop(context.Context) error {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
configFile := os.Getenv("CONFIG_FILE")
|
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)
|
logger.Info("Loading config file: ", configFile)
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := recover(); err != nil {
|
if err := recover(); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user