The way I like to do it is to pass a module on the command line that contains the custom config. So in the app:

---
import myapp.config;

// use the variables defined in there like normal
---


Now, to define a config file, you do something like:


myconfiguration.d # note that the file name can be anything!
---
module myapp.config; // but each must use this same module config

enum some_key = "some_value";
// and so on
---

Now, when you compile, you build it with a particular config by passing one of those files to the compile:

dmd myapp.d myconfiguration.d # or whatever single config you want



Then you can define as much as you want in the config module, and have as many of them as you want too.

Reply via email to