You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
546 B
30 lines
546 B
package config
|
|
|
|
import (
|
|
"log"
|
|
"encoding/json"
|
|
"os"
|
|
)
|
|
|
|
type config struct {
|
|
Views string `json:"views"`
|
|
Layout string `json:"layout"`
|
|
Target string `json:"target"`
|
|
WatchDelay string `json:"watch_delay"`
|
|
SyncDir string `json:"sync_dir"`
|
|
MetaFiles []string `json:"meta_files"`
|
|
}
|
|
|
|
var Settings config
|
|
|
|
func Load(path string) {
|
|
config, err := os.ReadFile(path)
|
|
if err != nil {
|
|
log.Fatalf("invalid config path: %s", path)
|
|
}
|
|
|
|
err = json.Unmarshal(config, &Settings)
|
|
if err != nil {
|
|
log.Fatalf("json format error:", err)
|
|
}
|
|
}
|
|
|