up
This commit is contained in:
@@ -5,6 +5,7 @@ main.exe
|
||||
|
||||
# Auto-generated runtime data (config + database + uploads)
|
||||
win/
|
||||
mac/
|
||||
|
||||
# IDE
|
||||
.vscode/
|
||||
|
||||
+11
-4
@@ -32,9 +32,12 @@ const mysqlExampleDSN = "user:password@tcp(127.0.0.1:3306)/blog_go?charset=utf8m
|
||||
|
||||
// getConfigPath returns the OS-aware config directory and config file path.
|
||||
func getConfigPath() (dir, file string) {
|
||||
if runtime.GOOS == "windows" {
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
dir = filepath.Join(".", "win", "etc", "blog_go")
|
||||
} else {
|
||||
case "darwin":
|
||||
dir = filepath.Join(".", "mac", "etc", "blog_go")
|
||||
default:
|
||||
dir = filepath.Join("/", "etc", "blog_go")
|
||||
}
|
||||
file = filepath.Join(dir, "config.yaml")
|
||||
@@ -43,10 +46,14 @@ func getConfigPath() (dir, file string) {
|
||||
|
||||
// getDefaultStoragePath returns the OS-aware default storage path.
|
||||
func getDefaultStoragePath() string {
|
||||
if runtime.GOOS == "windows" {
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
return filepath.Join(".", "win", "srv", "blog_go")
|
||||
case "darwin":
|
||||
return filepath.Join(".", "mac", "srv", "blog_go")
|
||||
default:
|
||||
return filepath.Join("/", "srv", "blog_go")
|
||||
}
|
||||
return filepath.Join("/", "srv", "blog_go")
|
||||
}
|
||||
|
||||
// generateSecret returns a random-ish hex string for the session secret.
|
||||
|
||||
Reference in New Issue
Block a user