Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
da94b96b
Commit
da94b96b
authored
May 02, 2022
by
boojack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update mode flag
parent
08682a82
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
profile.go
common/profile.go
+3
-3
server.go
server/server.go
+1
-1
sqlite.go
store/sqlite.go
+1
-1
No files found.
common/profile.go
View file @
da94b96b
...
@@ -9,7 +9,7 @@ import (
...
@@ -9,7 +9,7 @@ import (
)
)
type
Profile
struct
{
type
Profile
struct
{
// Mode can be "
release
" or "dev"
// Mode can be "
prod
" or "dev"
Mode
string
`json:"mode"`
Mode
string
`json:"mode"`
// Port is the binding port for server.
// Port is the binding port for server.
Port
int
`json:"port"`
Port
int
`json:"port"`
...
@@ -41,7 +41,7 @@ func checkDSN(dataDir string) (string, error) {
...
@@ -41,7 +41,7 @@ func checkDSN(dataDir string) (string, error) {
// GetDevProfile will return a profile for dev.
// GetDevProfile will return a profile for dev.
func
GetProfile
()
Profile
{
func
GetProfile
()
Profile
{
mode
:=
os
.
Getenv
(
"mode"
)
mode
:=
os
.
Getenv
(
"mode"
)
if
mode
!=
"dev"
&&
mode
!=
"
release
"
{
if
mode
!=
"dev"
&&
mode
!=
"
prod
"
{
mode
=
"dev"
mode
=
"dev"
}
}
...
@@ -51,7 +51,7 @@ func GetProfile() Profile {
...
@@ -51,7 +51,7 @@ func GetProfile() Profile {
}
}
data
:=
""
data
:=
""
if
mode
==
"
release
"
{
if
mode
==
"
prod
"
{
data
=
"/var/opt/memos"
data
=
"/var/opt/memos"
}
}
...
...
server/server.go
View file @
da94b96b
...
@@ -49,7 +49,7 @@ func NewServer(profile *common.Profile) *Server {
...
@@ -49,7 +49,7 @@ func NewServer(profile *common.Profile) *Server {
// In dev mode, set the const secret key to make login session persistence.
// In dev mode, set the const secret key to make login session persistence.
secret
:=
[]
byte
(
"justmemos"
)
secret
:=
[]
byte
(
"justmemos"
)
if
profile
.
Mode
==
"
release
"
{
if
profile
.
Mode
==
"
prod
"
{
secret
=
securecookie
.
GenerateRandomKey
(
16
)
secret
=
securecookie
.
GenerateRandomKey
(
16
)
}
}
e
.
Use
(
session
.
Middleware
(
sessions
.
NewCookieStore
(
secret
)))
e
.
Use
(
session
.
Middleware
(
sessions
.
NewCookieStore
(
secret
)))
...
...
store/sqlite.go
View file @
da94b96b
...
@@ -23,7 +23,7 @@ type DB struct {
...
@@ -23,7 +23,7 @@ type DB struct {
Db
*
sql
.
DB
Db
*
sql
.
DB
// datasource name
// datasource name
DSN
string
DSN
string
// mode should be
release
or dev
// mode should be
prod
or dev
mode
string
mode
string
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment