PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
config_loader.h
Go to the documentation of this file.
1
11#pragma once
12
14
15#include <kcenon/common/patterns/result.h>
16
17#include <chrono>
18#include <cstdint>
19#include <filesystem>
20#include <optional>
21#include <string>
22#include <vector>
23
24namespace kcenon::pacs::samples {
25
26// =============================================================================
27// TLS Configuration
28// =============================================================================
29
33struct tls_config {
35 bool enabled{false};
36
38 std::filesystem::path certificate;
39
41 std::filesystem::path private_key;
42
44 std::filesystem::path ca_certificate;
45
48
50 std::string min_version{"1.2"};
51};
52
53// =============================================================================
54// Security Configuration
55// =============================================================================
56
62 bool enabled{true};
63
65 std::string default_role{"viewer"};
66};
67
78
92
93// =============================================================================
94// REST API Configuration
95// =============================================================================
96
102 bool enabled{true};
103
105 std::uint16_t port{8080};
106
108 bool cors_enabled{true};
109};
110
111// =============================================================================
112// Monitoring Configuration
113// =============================================================================
114
120 std::chrono::seconds health_check_interval{30};
121
123 bool metrics_enabled{true};
124};
125
126// =============================================================================
127// Database Configuration
128// =============================================================================
129
135 std::filesystem::path path{"./pacs_data/index.db"};
136};
137
138// =============================================================================
139// Storage Configuration
140// =============================================================================
141
147 std::filesystem::path root_path{"./pacs_data"};
148
150 std::string naming_scheme{"uid_hierarchical"};
151
153 std::string duplicate_policy{"replace"};
154
157};
158
159// =============================================================================
160// Server Configuration
161// =============================================================================
162
168 std::string ae_title{"PROD_PACS"};
169
171 std::uint16_t port{11112};
172
174 std::size_t max_associations{100};
175
177 std::chrono::seconds idle_timeout{300};
178
181};
182
183// =============================================================================
184// Logging Configuration
185// =============================================================================
186
192 std::string level{"info"};
193
195 std::filesystem::path audit_log_path;
196};
197
198// =============================================================================
199// Production Configuration
200// =============================================================================
201
226
227// =============================================================================
228// Config Loader
229// =============================================================================
230
249public:
255 [[nodiscard]] static auto load(const std::filesystem::path& path)
257
263 [[nodiscard]] static auto load_from_string(std::string_view yaml_content)
265
270 [[nodiscard]] static auto create_default() -> production_config;
271
277 [[nodiscard]] static auto validate(const production_config& config)
278 -> kcenon::common::VoidResult;
279
280private:
284 static auto parse_value(std::string_view value) -> std::string;
285
289 static auto parse_bool(std::string_view value) -> bool;
290
294 static auto parse_int(std::string_view value) -> int;
295
299 static auto parse_anonymization_profile(std::string_view value)
301
305 static auto trim(std::string_view str) -> std::string;
306};
307
308} // namespace kcenon::pacs::samples
DICOM de-identification profiles per PS3.15 Annex E.
static auto create_default() -> production_config
Create a default configuration.
static auto parse_int(std::string_view value) -> int
Parse an integer value.
static auto load(const std::filesystem::path &path) -> kcenon::common::Result< production_config >
Load configuration from a YAML file.
static auto parse_anonymization_profile(std::string_view value) -> security::anonymization_profile
Parse anonymization profile.
static auto parse_bool(std::string_view value) -> bool
Parse a boolean value.
static auto validate(const production_config &config) -> kcenon::common::VoidResult
Validate a configuration.
static auto parse_value(std::string_view value) -> std::string
Parse a YAML value (simple types)
static auto load_from_string(std::string_view yaml_content) -> kcenon::common::Result< production_config >
Load configuration from a YAML string.
static auto trim(std::string_view str) -> std::string
Trim whitespace from string.
anonymization_profile
DICOM de-identification profiles based on PS3.15 Annex E.
@ basic
Basic Profile - Remove direct identifiers.
std::string default_role
Default role for unknown AE titles.
bool enabled
Enable access control enforcement.
security::anonymization_profile profile
Anonymization profile to use.
bool auto_anonymize
Automatically anonymize incoming images.
Database configuration for index storage.
std::filesystem::path path
Path to SQLite database file.
std::filesystem::path audit_log_path
Path to audit log file.
std::string level
Log level: "debug", "info", "warn", "error".
Health monitoring configuration.
std::chrono::seconds health_check_interval
Interval between health checks (seconds)
bool metrics_enabled
Enable Prometheus-style metrics endpoint.
Complete production PACS configuration.
monitoring_config monitoring
Monitoring settings.
logging_config logging
Logging settings.
storage_config storage
Storage settings.
rest_api_config rest_api
REST API settings.
security_config security
Security settings.
server_config server
DICOM server settings.
REST API server configuration.
std::uint16_t port
HTTP port for REST API.
bool cors_enabled
Enable CORS for web clients.
bool enabled
Enable REST API server.
Complete security configuration.
std::vector< std::string > allowed_ae_titles
Allowed AE titles (supports wildcards with *)
access_control_config access_control
Access control settings.
anonymization_config anonymization
Anonymization settings.
DICOM server configuration.
std::uint16_t port
TCP port for DICOM connections.
tls_config tls
TLS configuration.
std::size_t max_associations
Maximum concurrent associations.
std::chrono::seconds idle_timeout
Idle timeout for associations (seconds)
std::string ae_title
Application Entity title (max 16 characters)
File storage configuration.
std::string naming_scheme
Naming scheme: "uid_flat", "uid_hierarchical", "date_based".
database_config database
Database configuration.
std::filesystem::path root_path
Root path for DICOM file storage.
TLS security configuration for DICOM connections.
std::filesystem::path ca_certificate
Path to CA certificate file (PEM format)
std::string min_version
Minimum TLS version ("1.2" or "1.3")
std::filesystem::path certificate
Path to server certificate file (PEM format)
bool require_client_cert
Require client certificate (mutual TLS)
std::filesystem::path private_key
Path to private key file (PEM format)
bool enabled
Enable TLS for DICOM connections.