🎨 加入只读模式配置
This commit is contained in:
parent
877e96df4d
commit
68fee17793
10
conf/wide.go
10
conf/wide.go
|
@ -84,8 +84,8 @@ var Docker bool
|
||||||
const DockerImageGo = "golang"
|
const DockerImageGo = "golang"
|
||||||
|
|
||||||
// Load loads the Wide configurations from wide.json and users' configurations from users/{userId}.json.
|
// Load loads the Wide configurations from wide.json and users' configurations from users/{userId}.json.
|
||||||
func Load(confPath, confData, confServer, confLogLevel string, confSiteStatCode template.HTML) {
|
func Load(confPath, confData, confServer, confLogLevel, confReadOnly string, confSiteStatCode template.HTML) {
|
||||||
initWide(confPath, confData, confServer, confLogLevel, confSiteStatCode)
|
initWide(confPath, confData, confServer, confLogLevel, confReadOnly, confSiteStatCode)
|
||||||
initUsers()
|
initUsers()
|
||||||
|
|
||||||
cmd := exec.Command("docker", "version")
|
cmd := exec.Command("docker", "version")
|
||||||
|
@ -155,7 +155,7 @@ func initUsers() {
|
||||||
initCustomizedConfs()
|
initCustomizedConfs()
|
||||||
}
|
}
|
||||||
|
|
||||||
func initWide(confPath, confData, confServer, confLogLevel string, confSiteStatCode template.HTML) {
|
func initWide(confPath, confData, confServer, confLogLevel, confReadOnly string, confSiteStatCode template.HTML) {
|
||||||
bytes, err := ioutil.ReadFile(confPath)
|
bytes, err := ioutil.ReadFile(confPath)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
|
@ -219,6 +219,10 @@ func initWide(confPath, confData, confServer, confLogLevel string, confSiteStatC
|
||||||
Wide.Server = confServer
|
Wide.Server = confServer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if "" != confReadOnly {
|
||||||
|
Wide.ReadOnly, _ = strconv.ParseBool(confReadOnly)
|
||||||
|
}
|
||||||
|
|
||||||
// SiteStatCode
|
// SiteStatCode
|
||||||
if "" != confSiteStatCode {
|
if "" != confSiteStatCode {
|
||||||
Wide.SiteStatCode = confSiteStatCode
|
Wide.SiteStatCode = confSiteStatCode
|
||||||
|
|
3
main.go
3
main.go
|
@ -50,6 +50,7 @@ func init() {
|
||||||
confData := flag.String("data", "", "path of data dir")
|
confData := flag.String("data", "", "path of data dir")
|
||||||
confServer := flag.String("server", "", "this will overwrite Wide.Server if specified")
|
confServer := flag.String("server", "", "this will overwrite Wide.Server if specified")
|
||||||
confLogLevel := flag.String("log_level", "", "this will overwrite Wide.LogLevel if specified")
|
confLogLevel := flag.String("log_level", "", "this will overwrite Wide.LogLevel if specified")
|
||||||
|
confReadOnly := flag.String("readonly", "", "this will overrite Wide.ReadOnly if specified")
|
||||||
confSiteStatCode := flag.String("site_stat_code", "", "this will overrite Wide.SiteStatCode if specified")
|
confSiteStatCode := flag.String("site_stat_code", "", "this will overrite Wide.SiteStatCode if specified")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
@ -66,7 +67,7 @@ func init() {
|
||||||
|
|
||||||
i18n.Load()
|
i18n.Load()
|
||||||
event.Load()
|
event.Load()
|
||||||
conf.Load(*confPath, *confData, *confServer, *confLogLevel, template.HTML(*confSiteStatCode))
|
conf.Load(*confPath, *confData, *confServer, *confLogLevel, *confReadOnly, template.HTML(*confSiteStatCode))
|
||||||
|
|
||||||
conf.FixedTimeCheckEnv()
|
conf.FixedTimeCheckEnv()
|
||||||
session.FixedTimeSave()
|
session.FixedTimeSave()
|
||||||
|
|
Loading…
Reference in New Issue