diff options
author | xengineering <me@xengineering.eu> | 2024-05-01 13:58:54 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2024-05-01 13:58:54 +0200 |
commit | 1e2a3377e43786e25dc03b8612513d47f8dfb3c6 (patch) | |
tree | b1dbe786260a9cd47e9a9af3549e95df27184179 /config.go | |
parent | 390642f9bbc12f0b435f343fc35f4a47c5ec7680 (diff) | |
download | ceres-1e2a3377e43786e25dc03b8612513d47f8dfb3c6.tar ceres-1e2a3377e43786e25dc03b8612513d47f8dfb3c6.tar.zst ceres-1e2a3377e43786e25dc03b8612513d47f8dfb3c6.zip |
Add --config flag
This re-enables config file support.
Diffstat (limited to 'config.go')
-rw-r--r-- | config.go | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -4,12 +4,14 @@ import ( _ "embed" "encoding/json" "log" + "os" ) //go:embed default_config.json var defaultConfig string type CeresConfig struct { + Path string HttpAddress string `json:"http_address"` StorageFilePath string `json:"storage_file_path"` } @@ -22,3 +24,15 @@ func init() { log.Fatal(err) } } + +func (c *CeresConfig) Read() { + data, err := os.ReadFile(c.Path) + if err != nil { + log.Fatal(err) + } + + err = json.Unmarshal(data, &c) + if err != nil { + log.Fatal(err) + } +} |