diff --git a/common/init.go b/common/init.go index 1e9c85c..81c62bb 100644 --- a/common/init.go +++ b/common/init.go @@ -36,7 +36,14 @@ func init() { } if os.Getenv("SESSION_SECRET") != "" { - SessionSecret = os.Getenv("SESSION_SECRET") + ss := os.Getenv("SESSION_SECRET") + if ss == "random_string" { + log.Println("WARNING: SESSION_SECRET is set to the default value 'random_string', please change it to a random string.") + log.Println("警告:SESSION_SECRET被设置为默认值'random_string',请修改为随机字符串。") + log.Fatal("Please set SESSION_SECRET to a random string.") + } else { + SessionSecret = ss + } } if os.Getenv("SQLITE_PATH") != "" { SQLitePath = os.Getenv("SQLITE_PATH")