chore: update mode flag

This commit is contained in:
boojack 2022-05-02 09:40:25 +08:00
parent 08682a822e
commit da94b96b0e
3 changed files with 5 additions and 5 deletions

View file

@ -9,7 +9,7 @@ import (
)
type Profile struct {
// Mode can be "release" or "dev"
// Mode can be "prod" or "dev"
Mode string `json:"mode"`
// Port is the binding port for server.
Port int `json:"port"`
@ -41,7 +41,7 @@ func checkDSN(dataDir string) (string, error) {
// GetDevProfile will return a profile for dev.
func GetProfile() Profile {
mode := os.Getenv("mode")
if mode != "dev" && mode != "release" {
if mode != "dev" && mode != "prod" {
mode = "dev"
}
@ -51,7 +51,7 @@ func GetProfile() Profile {
}
data := ""
if mode == "release" {
if mode == "prod" {
data = "/var/opt/memos"
}

View file

@ -49,7 +49,7 @@ func NewServer(profile *common.Profile) *Server {
// In dev mode, set the const secret key to make login session persistence.
secret := []byte("justmemos")
if profile.Mode == "release" {
if profile.Mode == "prod" {
secret = securecookie.GenerateRandomKey(16)
}
e.Use(session.Middleware(sessions.NewCookieStore(secret)))

View file

@ -23,7 +23,7 @@ type DB struct {
Db *sql.DB
// datasource name
DSN string
// mode should be release or dev
// mode should be prod or dev
mode string
}