37 lines
692 B
Go
37 lines
692 B
Go
package common
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path"
|
|
)
|
|
|
|
var (
|
|
PageSize uint = 10
|
|
VisitorPageSize uint = 8
|
|
Version string = "0.3.9"
|
|
VisitorExpire float64 = 600
|
|
Upload string = "static/upload/"
|
|
Dir string = "config/"
|
|
MysqlConf string = Dir + "mysql.json"
|
|
IsCompireTemplate bool = false //是否编译静态模板到二进制
|
|
)
|
|
|
|
const (
|
|
ENV_DEV = "dev"
|
|
ENV_PROD = "prod"
|
|
)
|
|
|
|
var (
|
|
environment = os.Getenv("AICSS_ENV")
|
|
)
|
|
|
|
func getConfigPath() string {
|
|
switch environment {
|
|
case ENV_DEV, ENV_PROD:
|
|
return path.Join(Dir, fmt.Sprintf("config_%s.yaml", environment))
|
|
default:
|
|
return path.Join(Dir, "config.yaml")
|
|
}
|
|
}
|