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/*
15 * NOTE: DO NOT EDIT THIS FILE DIRECTLY. It is AUTO-GENERATED from config_schema.yaml.
16 * To add new config values or make other changes, edit config_schema.yaml and regenerate via:
17 *
18 * uv run scripts/generate_config.py
19 */
20
21class ConfigProvider; // forward declaration to avoid app -> infra dependency
22
26class AppConfig {
27 public:
28 virtual ~AppConfig() = default;
29
40 virtual void add_provider(std::unique_ptr<ConfigProvider> provider) = 0;
41
42 // Public method with cross-field validation only (Tier 3)
44 verify_checksums(ConfigScopeType type, const std::string &scope) const
45 {
46 auto validated_val = verify_checksums_validated(type, scope);
47 return validated_val;
48 }
49
50 // Public method with cross-field validation only (Tier 3)
52 primary_pairing_mode(ConfigScopeType type, const std::string &scope) const
53 {
54 auto validated_val = primary_pairing_mode_validated(type, scope);
55 return validated_val;
56 }
57
58 // Public method with cross-field validation only (Tier 3)
60 primary_pairing_partners(ConfigScopeType type, const std::string &scope) const
61 {
62 auto validated_val = primary_pairing_partners_validated(type, scope);
63 return validated_val;
64 }
65
66 // Public method with cross-field validation only (Tier 3)
68 diagnostic_warnings_exclude(ConfigScopeType type, const std::string &scope) const
69 {
70 auto validated_val = diagnostic_warnings_exclude_validated(type, scope);
71 return validated_val;
72 }
73
74 // Public method with cross-field validation only (Tier 3)
76 diagnostic_warnings_include(ConfigScopeType type, const std::string &scope) const
77 {
78 auto validated_val = diagnostic_warnings_include_validated(type, scope);
79 return validated_val;
80 }
81
82 // Public method with cross-field validation only (Tier 3)
84 diagnostic_remarks_exclude(ConfigScopeType type, const std::string &scope) const
85 {
86 auto validated_val = diagnostic_remarks_exclude_validated(type, scope);
87 return validated_val;
88 }
89
90 // Public method with cross-field validation only (Tier 3)
92 diagnostic_remarks_include(ConfigScopeType type, const std::string &scope) const
93 {
94 auto validated_val = diagnostic_remarks_include_validated(type, scope);
95 return validated_val;
96 }
97
98
99 protected:
100
101 // Protected method with single-value validation only (Tier 2)
102 [[nodiscard]] virtual ChainableResult<ConfigValue<bool>>
103 verify_checksums_validated(ConfigScopeType type, const std::string &scope) const
104 {
105 auto raw_val = verify_checksums_raw(type, scope);
106 return raw_val;
107 }
108
109 // Protected virtual method that fetches raw value from provider (Tier 1)
110 [[nodiscard]] virtual ChainableResult<ConfigValue<bool>>
111 verify_checksums_raw(ConfigScopeType type, const std::string &scope) const = 0;
112
113 // Protected method with single-value validation only (Tier 2)
115 primary_pairing_mode_validated(ConfigScopeType type, const std::string &scope) const
116 {
117 auto raw_val = primary_pairing_mode_raw(type, scope);
118 return raw_val;
119 }
120
121 // Protected virtual method that fetches raw value from provider (Tier 1)
123 primary_pairing_mode_raw(ConfigScopeType type, const std::string &scope) const = 0;
124
125 // Protected method with single-value validation only (Tier 2)
127 primary_pairing_partners_validated(ConfigScopeType type, const std::string &scope) const
128 {
129 auto raw_val = primary_pairing_partners_raw(type, scope);
130 return raw_val;
131 }
132
133 // Protected virtual method that fetches raw value from provider (Tier 1)
135 primary_pairing_partners_raw(ConfigScopeType type, const std::string &scope) const = 0;
136
137 // Protected method with single-value validation only (Tier 2)
139 diagnostic_warnings_exclude_validated(ConfigScopeType type, const std::string &scope) const
140 {
141 auto raw_val = diagnostic_warnings_exclude_raw(type, scope);
142 return raw_val;
143 }
144
145 // Protected virtual method that fetches raw value from provider (Tier 1)
147 diagnostic_warnings_exclude_raw(ConfigScopeType type, const std::string &scope) const = 0;
148
149 // Protected method with single-value validation only (Tier 2)
151 diagnostic_warnings_include_validated(ConfigScopeType type, const std::string &scope) const
152 {
153 auto raw_val = diagnostic_warnings_include_raw(type, scope);
154 return raw_val;
155 }
156
157 // Protected virtual method that fetches raw value from provider (Tier 1)
159 diagnostic_warnings_include_raw(ConfigScopeType type, const std::string &scope) const = 0;
160
161 // Protected method with single-value validation only (Tier 2)
163 diagnostic_remarks_exclude_validated(ConfigScopeType type, const std::string &scope) const
164 {
165 auto raw_val = diagnostic_remarks_exclude_raw(type, scope);
166 return raw_val;
167 }
168
169 // Protected virtual method that fetches raw value from provider (Tier 1)
171 diagnostic_remarks_exclude_raw(ConfigScopeType type, const std::string &scope) const = 0;
172
173 // Protected method with single-value validation only (Tier 2)
175 diagnostic_remarks_include_validated(ConfigScopeType type, const std::string &scope) const
176 {
177 auto raw_val = diagnostic_remarks_include_raw(type, scope);
178 return raw_val;
179 }
180
181 // Protected virtual method that fetches raw value from provider (Tier 1)
183 diagnostic_remarks_include_raw(ConfigScopeType type, const std::string &scope) const = 0;
184
185};
186
187} // 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.
ConfigScopeType
Specifies the scope type for configuration value lookups.
Cross-cutting configuration validators shared across all architectural layers.