From 0bd94a2290057918e6a41b336a8bc5a0242c1d5b Mon Sep 17 00:00:00 2001 From: Jared Turner Date: Mon, 8 Jun 2020 15:24:17 +0100 Subject: [PATCH] Add config path to Config --- src/config.cr | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/config.cr b/src/config.cr index 5e57edf..71177e5 100644 --- a/src/config.cr +++ b/src/config.cr @@ -3,6 +3,8 @@ require "yaml" class Config include YAML::Serializable + @[YAML::Field(ignore: true)] + property path : String = "" property port : Int32 = 9000 property library_path : String = File.expand_path "~/mango/library", home: true @@ -29,6 +31,7 @@ class Config cfg_path = File.expand_path path, home: true if File.exists? cfg_path config = self.from_yaml File.read cfg_path + config.path = path config.fill_defaults return config end @@ -39,6 +42,7 @@ class Config abort "Aborting..." end default = self.allocate + default.path = path default.fill_defaults cfg_dir = File.dirname cfg_path unless Dir.exists? cfg_dir