diff options
author | ache <ache@ache.one> | 2021-02-28 21:59:58 +0100 |
---|---|---|
committer | ache <ache@ache.one> | 2021-02-28 21:59:58 +0100 |
commit | 94fb8f24282be3aa41f275cb21d1eca76c1899a1 (patch) | |
tree | 7e810152655d73243711d519a01cc13801cb53b7 /config/config.go | |
parent | Multiple upload (diff) |
Config + 1.16 + MultiSelection
Diffstat (limited to 'config/config.go')
-rw-r--r-- | config/config.go | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/config/config.go b/config/config.go index 48fbff4..ddf3f0a 100644 --- a/config/config.go +++ b/config/config.go @@ -9,15 +9,18 @@ import ( type config struct { Hostnames []string `json:"hosts"` Port int `json:"port"` - AllowLocalPath bool `json:"allow-local-path"` + AllowHidden bool `json:"allow-hidden"` Auth bool `json:"auth"` RootPath string `json:"root-path"` } var Config config -func ReadConfig() error { - file, err := os.Open("config.json") +func ReadConfig(path string) error { + if path == "" { + path = "config.json" + } + file, err := os.Open(path) if err != nil { return err @@ -31,3 +34,11 @@ func ReadConfig() error { return nil } + +func SetDefaultValue() { + Config.Hostnames = []string{"localhost"} + Config.Port = 8080 + Config.AllowHidden = false + Config.Auth = false + Config.RootPath = "." +} |