hummus 0.1.6-alpha
Pluggable configuration engine
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
hummus
Easy template-enabled configuration engine
Usage
Below is an example of how we can use a provider to fill up the values within a complex data structure:
import hummus.cfg : fill;
struct X
{
private string p;
}
struct A
{
private int x, y;
private X z;
}
struct MinhaConfiguracao
{
private string adres;
private size_t porto;
private A s;
// private A si;
}
auto mc = MinhaConfiguracao();
auto ds = new DummySink();
fill(mc, ds);
writeln("Provider had requests for: ", ds._s.keys);
// show how the struct was filed
// up
writeln(mc);
assert(mc.porto == 443);
assert(mc.s.x == 10);
assert(mc.s.y == -10);
Right at the end we can see how all the values would
have been filled out when we did writeln(mc)
:
MinhaConfiguracao("v:adres", 443, A(10, -10, X("v:s.z.p")))
Providers
If you want to implement a provider then take a look at the documentation so you can see what you would need to implement.
The providers that come with this package are:
EnvironmentProvider
- This uses environment variables to provision
- Module name is
hummus.providers.env
JSONProvider
- This uses a JSON file to provision
- Module name is
hummus.providers.json
Development
Testing
In order to run the full test suite use the following command:
V=1 I__Z=2 dub test
The reason for the declaration of the environment
variables V=1 I__Z=2
is because onfe of the tests
is for the EnvironmentProvider
which searches
for environment variables, and in particular its
unittest looks for those two.
License
Licensed under the LGPL-2.0-only .
- 0.1.6-alpha released 20 hours ago
- deavmi/hummus
- LGPL-2.0-only
- Copyright © 2025, Tristan Brice Velloza Kildaire
- Authors:
- Dependencies:
- niknaks
- Versions:
-
0.1.10-alpha 2025-Jun-30 0.1.9-alpha 2025-Jun-30 0.1.8-alpha 2025-Jun-30 0.1.7-alpha 2025-Jun-30 0.1.6-alpha 2025-Jun-30 - Download Stats:
-
-
15 downloads today
-
29 downloads this week
-
29 downloads this month
-
29 downloads total
-
- Score:
- 0.5
- Short URL:
- hummus.dub.pm