🎨 加入只读模式配置
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"
|
||||
|
||||
// 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) {
|
||||
initWide(confPath, confData, confServer, confLogLevel, confSiteStatCode)
|
||||
func Load(confPath, confData, confServer, confLogLevel, confReadOnly string, confSiteStatCode template.HTML) {
|
||||
initWide(confPath, confData, confServer, confLogLevel, confReadOnly, confSiteStatCode)
|
||||
initUsers()
|
||||
|
||||
cmd := exec.Command("docker", "version")
|
||||
|
@ -155,7 +155,7 @@ func initUsers() {
|
|||
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)
|
||||
if nil != err {
|
||||
logger.Error(err)
|
||||
|
@ -219,6 +219,10 @@ func initWide(confPath, confData, confServer, confLogLevel string, confSiteStatC
|
|||
Wide.Server = confServer
|
||||
}
|
||||
|
||||
if "" != confReadOnly {
|
||||
Wide.ReadOnly, _ = strconv.ParseBool(confReadOnly)
|
||||
}
|
||||
|
||||
// SiteStatCode
|
||||
if "" != confSiteStatCode {
|
||||
Wide.SiteStatCode = confSiteStatCode
|
||||
|
|
3
main.go
3
main.go
|
@ -50,6 +50,7 @@ func init() {
|
|||
confData := flag.String("data", "", "path of data dir")
|
||||
confServer := flag.String("server", "", "this will overwrite Wide.Server 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")
|
||||
|
||||
flag.Parse()
|
||||
|
@ -66,7 +67,7 @@ func init() {
|
|||
|
||||
i18n.Load()
|
||||
event.Load()
|
||||
conf.Load(*confPath, *confData, *confServer, *confLogLevel, template.HTML(*confSiteStatCode))
|
||||
conf.Load(*confPath, *confData, *confServer, *confLogLevel, *confReadOnly, template.HTML(*confSiteStatCode))
|
||||
|
||||
conf.FixedTimeCheckEnv()
|
||||
session.FixedTimeSave()
|
||||
|
|
Loading…
Reference in New Issue