feat(configuration): bounded schemas, provenance/redaction, and async transactional ReloadController
This commit is contained in:
1 parent
a24e086e47
commit
1dc51d5c43
14 files changed
+3351
No files matched your search
@@ -0,0 +1,21 @@
|
||||
#include <Void/Configuration/Bind.hpp>
|
||||
#include <Void/Configuration/Config.hpp>
|
||||
#include <Void/Configuration/Schema.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
struct MinimalCfg {
|
||||
[[= Void::Configuration::Required{}]] std::string name;
|
||||
[[= Void::Configuration::IntRange{1, 100}]] int workers{4};
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
Void::Configuration::SourceSet ss;
|
||||
ss.add_defaults_map("def", {{"name", "svc"}, {"workers", "8"}});
|
||||
auto schema = Void::Configuration::Schema<MinimalCfg>::from_reflection();
|
||||
auto merged = Void::Configuration::load_sources(ss, schema.limits());
|
||||
if (!merged) return 1;
|
||||
auto val = Void::Configuration::validate<MinimalCfg>(*merged, schema);
|
||||
return val && val->value.name == "svc" && val->value.workers == 8 ? 0 : 2;
|
||||
}
|
||||
Reference in new issue
Block a user