mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
feat(mode): add demo mode (#1121)
* feat(mode): add demo mode * chroe: Update store/db/db.go Co-authored-by: boojack <stevenlgtm@gmail.com> * chroe: Update store/db/db.go Co-authored-by: boojack <stevenlgtm@gmail.com> --------- Co-authored-by: boojack <stevenlgtm@gmail.com>
This commit is contained in:
@ -12,7 +12,7 @@ import (
|
||||
|
||||
// Profile is the configuration to start main server.
|
||||
type Profile struct {
|
||||
// Mode can be "prod" or "dev"
|
||||
// Mode can be "prod" or "dev" or "demo"
|
||||
Mode string `json:"mode"`
|
||||
// Port is the binding port for server
|
||||
Port int `json:"-"`
|
||||
@ -47,13 +47,13 @@ func checkDSN(dataDir string) (string, error) {
|
||||
// GetDevProfile will return a profile for dev or prod.
|
||||
func GetProfile() (*Profile, error) {
|
||||
profile := Profile{}
|
||||
flag.StringVar(&profile.Mode, "mode", "dev", "mode of server")
|
||||
flag.StringVar(&profile.Mode, "mode", "demo", "mode of server")
|
||||
flag.IntVar(&profile.Port, "port", 8081, "port of server")
|
||||
flag.StringVar(&profile.Data, "data", "", "data directory")
|
||||
flag.Parse()
|
||||
|
||||
if profile.Mode != "dev" && profile.Mode != "prod" {
|
||||
profile.Mode = "dev"
|
||||
if profile.Mode != "dev" && profile.Mode != "prod" && profile.Mode != "demo" {
|
||||
profile.Mode = "demo"
|
||||
}
|
||||
|
||||
if profile.Mode == "prod" && profile.Data == "" {
|
||||
|
Reference in New Issue
Block a user