mirror of
https://github.com/usememos/memos.git
synced 2024-12-26 23:22:47 +08:00
chore: update mode flag
This commit is contained in:
parent
08682a822e
commit
da94b96b0e
3 changed files with 5 additions and 5 deletions
|
@ -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"
|
||||
}
|
||||
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue