read only mode a gogo
This commit is contained in:
@@ -19,6 +19,7 @@ var (
|
||||
Foot string
|
||||
OAuthServer string
|
||||
VersionInterval time.Duration
|
||||
ReadOnly bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -36,11 +37,12 @@ func Refresh() {
|
||||
as.Append(args.STRING, "wrap", "file with http header/footer", "")
|
||||
as.Append(args.STRING, "oauth", "oauth URL", "")
|
||||
as.Append(args.DURATION, "version", "duration to mark versions", "0s")
|
||||
as.Append(args.BOOL, "ro", "read-only mode", false)
|
||||
if err := as.Parse(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
wrap := as.Get("wrap").GetString()
|
||||
wrap := as.GetString("wrap")
|
||||
var b []byte
|
||||
if len(wrap) > 0 {
|
||||
log.Printf("reading %v (%T)", wrap, wrap)
|
||||
@@ -57,13 +59,14 @@ func Refresh() {
|
||||
panic(len(bs))
|
||||
}
|
||||
|
||||
Root = strings.TrimSuffix(as.Get("root").GetString(), "/")
|
||||
Root = strings.TrimSuffix(as.GetString("root"), "/")
|
||||
Root, _ = filepath.Abs(Root)
|
||||
Port = ":" + strings.TrimPrefix(as.Get("port").GetString(), ":")
|
||||
Port = ":" + strings.TrimPrefix(as.GetString("port"), ":")
|
||||
Head = string(bs[0])
|
||||
Foot = string(bs[1])
|
||||
OAuthServer = as.Get("oauth").GetString()
|
||||
VersionInterval = as.Get("version").GetDuration()
|
||||
OAuthServer = as.GetString("oauth")
|
||||
VersionInterval = as.GetDuration("version")
|
||||
ReadOnly = as.GetBool("ro")
|
||||
}
|
||||
|
||||
const defaultWrapper = `
|
||||
|
||||
Reference in New Issue
Block a user