summaryrefslogtreecommitdiff
path: root/config.go
diff options
context:
space:
mode:
authorFlu0r1ne <flur01ne@flu0r1ne.net>2021-09-05 18:57:59 -0500
committerFlu0r1ne <flur01ne@flu0r1ne.net>2021-09-05 18:57:59 -0500
commit91666d1f2e766bc7c3073ed4cd731637c6885e36 (patch)
tree77f08826098918355fbce5da2ea939eafbc24f6e /config.go
parent465969af0d6a3e69e56de2048eb811e68d6f27a1 (diff)
downloaddeb-planr-91666d1f2e766bc7c3073ed4cd731637c6885e36.tar.xz
deb-planr-91666d1f2e766bc7c3073ed4cd731637c6885e36.zip
Do not throw fatal error when missing config, this behavior will be enabled in future releases
Diffstat (limited to 'config.go')
-rw-r--r--config.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/config.go b/config.go
index 88495e3..d7cd3e4 100644
--- a/config.go
+++ b/config.go
@@ -13,14 +13,21 @@ type Config struct {
const PLANR_CONFIG_FILE = "config.toml"
-func DecodeConfig(configDir string) Config {
- cfg := Config { }
+// TODO: REMOVE
+const STRICTLY_REQUIRE_CONFIG = false
+
+func DecodeConfig(configDir string) *Config {
+ cfg := new(Config)
configFile := path.Join(configDir, PLANR_CONFIG_FILE)
- if _, err := toml.DecodeFile(configFile, &cfg); err != nil {
+ if _, err := toml.DecodeFile(configFile, cfg); err != nil {
+ cfg = nil
+
// TODO: handle missing config
- log.Fatalf("Could not decode global configuration %s: %v", configFile, err)
+ if STRICTLY_REQUIRE_CONFIG {
+ log.Fatalf("Could not decode global configuration %s: %v", configFile, err)
+ }
}
return cfg