Porytiles
Loading...
Searching...
No Matches
app_config.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <string>
5
11
12namespace porytiles {
13
14// NOTE: DO NOT EDIT THIS FILE DIRECTLY. It is AUTO-GENERATED from config_schema.yaml.
15// To add new config values or make other changes, edit config_schema.yaml and regenerate via:
16//
17// uv run scripts/generate_config.py
18
19class ConfigProvider; // forward declaration to avoid app -> infra dependency
20
22class AppConfig {
23 public:
24 virtual ~AppConfig() = default;
25
34 virtual void add_provider(std::unique_ptr<ConfigProvider> provider) = 0;
35
36 // Public method with cross-field validation only (Tier 3)
38 verify_checksums(ConfigScopeType type, const std::string &scope) const
39 {
40 auto validated_val = verify_checksums_validated(type, scope);
41 return validated_val;
42 }
43
44 // Public method with cross-field validation only (Tier 3)
46 primary_pairing_mode(ConfigScopeType type, const std::string &scope) const
47 {
48 auto validated_val = primary_pairing_mode_validated(type, scope);
49 return validated_val;
50 }
51
52 // Public method with cross-field validation only (Tier 3)
54 primary_pairing_partners(ConfigScopeType type, const std::string &scope) const
55 {
56 auto validated_val = primary_pairing_partners_validated(type, scope);
57 return validated_val;
58 }
59
60 // Public method with cross-field validation only (Tier 3)
62 diagnostic_warnings_exclude(ConfigScopeType type, const std::string &scope) const
63 {
64 auto validated_val = diagnostic_warnings_exclude_validated(type, scope);
65 return validated_val;
66 }
67
68 // Public method with cross-field validation only (Tier 3)
70 diagnostic_warnings_include(ConfigScopeType type, const std::string &scope) const
71 {
72 auto validated_val = diagnostic_warnings_include_validated(type, scope);
73 return validated_val;
74 }
75
76 // Public method with cross-field validation only (Tier 3)
78 diagnostic_remarks_exclude(ConfigScopeType type, const std::string &scope) const
79 {
80 auto validated_val = diagnostic_remarks_exclude_validated(type, scope);
81 return validated_val;
82 }
83
84 // Public method with cross-field validation only (Tier 3)
86 diagnostic_remarks_include(ConfigScopeType type, const std::string &scope) const
87 {
88 auto validated_val = diagnostic_remarks_include_validated(type, scope);
89 return validated_val;
90 }
91
92 protected:
93 // Protected method with single-value validation only (Tier 2)
94 [[nodiscard]] virtual ChainableResult<ConfigValue<bool>>
95 verify_checksums_validated(ConfigScopeType type, const std::string &scope) const
96 {
97 auto raw_val = verify_checksums_raw(type, scope);
98 return raw_val;
99 }
100
101 // Protected virtual method that fetches raw value from provider (Tier 1)
102 [[nodiscard]] virtual ChainableResult<ConfigValue<bool>>
103 verify_checksums_raw(ConfigScopeType type, const std::string &scope) const = 0;
104
105 // Protected method with single-value validation only (Tier 2)
107 primary_pairing_mode_validated(ConfigScopeType type, const std::string &scope) const
108 {
109 auto raw_val = primary_pairing_mode_raw(type, scope);
110 return raw_val;
111 }
112
113 // Protected virtual method that fetches raw value from provider (Tier 1)
115 primary_pairing_mode_raw(ConfigScopeType type, const std::string &scope) const = 0;
116
117 // Protected method with single-value validation only (Tier 2)
119 primary_pairing_partners_validated(ConfigScopeType type, const std::string &scope) const
120 {
121 auto raw_val = primary_pairing_partners_raw(type, scope);
122 return raw_val;
123 }
124
125 // Protected virtual method that fetches raw value from provider (Tier 1)
127 primary_pairing_partners_raw(ConfigScopeType type, const std::string &scope) const = 0;
128
129 // Protected method with single-value validation only (Tier 2)
131 diagnostic_warnings_exclude_validated(ConfigScopeType type, const std::string &scope) const
132 {
133 auto raw_val = diagnostic_warnings_exclude_raw(type, scope);
134 return raw_val;
135 }
136
137 // Protected virtual method that fetches raw value from provider (Tier 1)
139 diagnostic_warnings_exclude_raw(ConfigScopeType type, const std::string &scope) const = 0;
140
141 // Protected method with single-value validation only (Tier 2)
143 diagnostic_warnings_include_validated(ConfigScopeType type, const std::string &scope) const
144 {
145 auto raw_val = diagnostic_warnings_include_raw(type, scope);
146 return raw_val;
147 }
148
149 // Protected virtual method that fetches raw value from provider (Tier 1)
151 diagnostic_warnings_include_raw(ConfigScopeType type, const std::string &scope) const = 0;
152
153 // Protected method with single-value validation only (Tier 2)
155 diagnostic_remarks_exclude_validated(ConfigScopeType type, const std::string &scope) const
156 {
157 auto raw_val = diagnostic_remarks_exclude_raw(type, scope);
158 return raw_val;
159 }
160
161 // Protected virtual method that fetches raw value from provider (Tier 1)
163 diagnostic_remarks_exclude_raw(ConfigScopeType type, const std::string &scope) const = 0;
164
165 // Protected method with single-value validation only (Tier 2)
167 diagnostic_remarks_include_validated(ConfigScopeType type, const std::string &scope) const
168 {
169 auto raw_val = diagnostic_remarks_include_raw(type, scope);
170 return raw_val;
171 }
172
173 // Protected virtual method that fetches raw value from provider (Tier 1)
175 diagnostic_remarks_include_raw(ConfigScopeType type, const std::string &scope) const = 0;
176};
177
178} // namespace porytiles
Interface that defines a complete app layer configuration.
ChainableResult< ConfigValue< std::vector< std::string > > > diagnostic_remarks_include(ConfigScopeType type, const std::string &scope) const
virtual ChainableResult< ConfigValue< std::vector< std::string > > > diagnostic_remarks_include_raw(ConfigScopeType type, const std::string &scope) const =0
ChainableResult< ConfigValue< std::vector< std::string > > > diagnostic_warnings_exclude(ConfigScopeType type, const std::string &scope) const
ChainableResult< ConfigValue< std::vector< std::string > > > diagnostic_warnings_include(ConfigScopeType type, const std::string &scope) const
ChainableResult< ConfigValue< bool > > verify_checksums(ConfigScopeType type, const std::string &scope) const
virtual ChainableResult< ConfigValue< bool > > verify_checksums_raw(ConfigScopeType type, const std::string &scope) const =0
virtual ChainableResult< ConfigValue< std::vector< std::string > > > diagnostic_remarks_include_validated(ConfigScopeType type, const std::string &scope) const
virtual void add_provider(std::unique_ptr< ConfigProvider > provider)=0
Prepends a ConfigProvider to the provider chain at highest priority.
virtual ChainableResult< ConfigValue< std::vector< std::string > > > diagnostic_remarks_exclude_raw(ConfigScopeType type, const std::string &scope) const =0
virtual ~AppConfig()=default
virtual ChainableResult< ConfigValue< std::vector< std::string > > > diagnostic_warnings_include_validated(ConfigScopeType type, const std::string &scope) const
ChainableResult< ConfigValue< PrimaryPairingMode > > primary_pairing_mode(ConfigScopeType type, const std::string &scope) const
ChainableResult< ConfigValue< std::vector< std::string > > > primary_pairing_partners(ConfigScopeType type, const std::string &scope) const
virtual ChainableResult< ConfigValue< std::vector< std::string > > > diagnostic_warnings_include_raw(ConfigScopeType type, const std::string &scope) const =0
virtual ChainableResult< ConfigValue< std::vector< std::string > > > diagnostic_warnings_exclude_validated(ConfigScopeType type, const std::string &scope) const
virtual ChainableResult< ConfigValue< std::vector< std::string > > > primary_pairing_partners_raw(ConfigScopeType type, const std::string &scope) const =0
virtual ChainableResult< ConfigValue< PrimaryPairingMode > > primary_pairing_mode_validated(ConfigScopeType type, const std::string &scope) const
virtual ChainableResult< ConfigValue< bool > > verify_checksums_validated(ConfigScopeType type, const std::string &scope) const
ChainableResult< ConfigValue< std::vector< std::string > > > diagnostic_remarks_exclude(ConfigScopeType type, const std::string &scope) const
virtual ChainableResult< ConfigValue< std::vector< std::string > > > diagnostic_remarks_exclude_validated(ConfigScopeType type, const std::string &scope) const
virtual ChainableResult< ConfigValue< PrimaryPairingMode > > primary_pairing_mode_raw(ConfigScopeType type, const std::string &scope) const =0
virtual ChainableResult< ConfigValue< std::vector< std::string > > > diagnostic_warnings_exclude_raw(ConfigScopeType type, const std::string &scope) const =0
virtual ChainableResult< ConfigValue< std::vector< std::string > > > primary_pairing_partners_validated(ConfigScopeType type, const std::string &scope) const
A result type that maintains a chainable sequence of errors for debugging and error reporting.
An interface which config implementations can use to load config values.
std::optional< ProviderDefinition > provider
ConfigScopeType
Specifies the scope type for configuration value lookups.
Cross-cutting configuration validators shared across all architectural layers.