summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorache <ache@ache.one>2021-02-28 21:59:58 +0100
committerache <ache@ache.one>2021-02-28 21:59:58 +0100
commit94fb8f24282be3aa41f275cb21d1eca76c1899a1 (patch)
tree7e810152655d73243711d519a01cc13801cb53b7 /config
parentMultiple upload (diff)
Config + 1.16 + MultiSelection
Diffstat (limited to 'config')
-rw-r--r--config/config.go17
-rw-r--r--config/config.json4
2 files changed, 17 insertions, 4 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 = "."
+}
diff --git a/config/config.json b/config/config.json
index 2bd396d..74dac99 100644
--- a/config/config.json
+++ b/config/config.json
@@ -1,4 +1,6 @@
{
"host":["localhost"],
- "port": 8080
+ "port": 8080,
+ "allow-hidden": false,
+ "auth": true
}