ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
config.c File Reference

📋 TOML configuration file parser with schema validation and CLI override support More...

Go to the source code of this file.

Data Structures

union  option_parsed_value_t
 Union holding all possible parsed option values. More...
 
struct  option_type_handler_t
 Type handler - encapsulates all 4 operations for one option type. More...
 
struct  config_builder_t
 Helper structure for building config content in a buffer. More...
 

Macros

Internal Macros
#define CONFIG_WARN(fmt, ...)
 Print configuration warning using the logging system.
 
#define CONFIG_DEBUG(fmt, ...)
 Print configuration debug message.
 

Functions

asciichat_error_t config_load_and_apply (asciichat_mode_t detected_mode, const char *config_path, bool strict, options_t *opts)
 Main function to load configuration from file and apply to global options.
 
asciichat_error_t config_create_default (const char *config_path)
 Create default configuration file with all default values.
 
asciichat_error_t config_load_system_and_user (asciichat_mode_t detected_mode, bool strict, options_t *opts)
 Load system config first, then user config (user config overrides system)
 
TOML Value Extraction Helpers

Helper functions to safely extract typed values from TOML datum structures.

Schema-Based Configuration Parser

Detailed Description

📋 TOML configuration file parser with schema validation and CLI override support

Definition in file config.c.

Macro Definition Documentation

◆ CONFIG_DEBUG

#define CONFIG_DEBUG (   fmt,
  ... 
)
Value:
do { \
/* Debug messages are only shown in debug builds after logging is initialized */ \
/* Use log_debug which safely checks initialization itself */ \
log_debug(fmt, ##__VA_ARGS__); \
} while (0)

Print configuration debug message.

Debug messages use the logging system if it's initialized, otherwise they are silently dropped.

Definition at line 57 of file config.c.

58 { \
59 /* Debug messages are only shown in debug builds after logging is initialized */ \
60 /* Use log_debug which safely checks initialization itself */ \
61 log_debug(fmt, ##__VA_ARGS__); \
62 } while (0)

◆ CONFIG_WARN

#define CONFIG_WARN (   fmt,
  ... 
)
Value:
do { \
log_warn("Config file: " fmt, ##__VA_ARGS__); \
} while (0)

Print configuration warning using the logging system.

Uses log_warn so that config warnings respect the –quiet flag and are routed through the logging system for proper filtering.

Definition at line 46 of file config.c.

47 { \
48 log_warn("Config file: " fmt, ##__VA_ARGS__); \
49 } while (0)