From 409f612eb87418a5bff09d5e83a19ffc6f2306f6 Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 1 May 2024 13:07:08 +0200 Subject: Implement parsing of embedded default config --- config.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 config.go diff --git a/config.go b/config.go new file mode 100644 index 0000000..f97f2a3 --- /dev/null +++ b/config.go @@ -0,0 +1,24 @@ +package main + +import ( + _ "embed" + "encoding/json" + "log" +) + +//go:embed default_config.json +var defaultConfig string + +type CeresConfig struct { + HttpAddress string `json:"http_address"` + StorageFilePath string `json:"storage_file_path"` +} + +var config CeresConfig + +func init() { + err := json.Unmarshal([]byte(defaultConfig), &config) + if err != nil { + log.Fatal(err) + } +} -- cgit v1.2.3-70-g09d2