- use logger

This commit is contained in:
Alex Ling
2020-02-16 21:24:19 +00:00
parent bb936b1fa6
commit 7168c6bfb2
10 changed files with 125 additions and 40 deletions

View File

@@ -4,17 +4,22 @@ class Config
include YAML::Serializable
@[YAML::Field(key: "port")]
property port = 9000
property port : Int32 = 9000
@[YAML::Field(key: "library_path")]
property library_path = File.expand_path "~/mango/library", home: true
property library_path : String = \
File.expand_path "~/mango/library", home: true
@[YAML::Field(key: "db_path")]
property db_path = File.expand_path "~/mango/mango.db", home: true
property db_path : String = \
File.expand_path "~/mango/mango.db", home: true
@[YAML::Field(key: "scan_interval_minutes")]
property scan_interval : Int32 = 5
@[YAML::Field(key: "log_level")]
property log_level : String = "info"
def self.load
cfg_path = File.expand_path "~/.config/mango/config.yml", home: true
if File.exists? cfg_path