DB: remove shared stuff, add singleton
Add Config class
This commit is contained in:
21
source/config.d
Normal file
21
source/config.d
Normal file
@@ -0,0 +1,21 @@
|
||||
module config;
|
||||
|
||||
import std.json;
|
||||
import std.file;
|
||||
|
||||
import slf4d;
|
||||
|
||||
class Config {
|
||||
JSONValue v;
|
||||
private string m_path;
|
||||
|
||||
this(string path = "./config.json") {
|
||||
this.m_path = path;
|
||||
}
|
||||
|
||||
void load() {
|
||||
debugF!"Trying to load config from %s"(this.m_path);
|
||||
string contents = readText(this.m_path);
|
||||
this.v = parseJSON(contents);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user