dconfig 0.0.2

A JSON based config management library for D programming language.


To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

dconfig

what is dconfig?

dconfig is a library for D programming language. This library can easily manage D's variables and values writteln in JSON.

usage

Add dependency for dconfig to your dub.sdl(dub.json)

example

import dconfig;

void main() {
    
    // prepare config class
    class Test {
        mixin HandleConfig;
        this() { this.initializeConfig(); }

        @config("test.json") int x;
    }
    
    // class instance is auto assigned JSON value
    import std.file : write;
    write("test.json", `{"x": 334}`);
    auto test = new Test;
    assert(test.x == 334);
    
    // you can reload while running
    write("test.json", `{"x": 810}`);
    ConfigManager().load();
    assert(test.x == 810);
}
Authors:
  • sobaya
Dependencies:
none
Versions:
0.0.2 2018-Jun-09
0.0.1 2018-May-27
~master 2018-Jun-23
Show all 3 versions
Download Stats:
  • 0 downloads today

  • 1 downloads this week

  • 2 downloads this month

  • 14 downloads total

Score:
0.3
Short URL:
dconfig.dub.pm