Pharos 0.7.23
Modern Web Framework & Web App Hosting Service.
Loading...
Searching...
No Matches
native_dynamic_config.c File Reference
#include "native_dynamic_config.h"
#include "native_app_config.h"
#include "native_json_config.h"
#include "native_support.h"
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Functions

int native_dynamic_config_key_is_path (const char *key)
 Returns whether a dynamic config key resolves relative to its config file.
char * native_dynamic_config_resolve_value_dup (const char *conf_path, const char *key, const char *raw_value)
 Resolves one raw dynamic config value against its owning config file.
char * native_dynamic_config_lookup_raw_dup (const char *conf_path, const char *key)
 Loads one raw dynamic config value from a config file when it exists.
char * native_dynamic_config_merged_value_dup (const char *app_root, const char *runtime_conf_path, const char *key)
 Loads one merged dynamic config value with runtime-conf precedence over app-local config.

Function Documentation

◆ native_dynamic_config_key_is_path()

int native_dynamic_config_key_is_path ( const char * key)

Returns whether a dynamic config key resolves relative to its config file.

Parameters
keyConfig key name.
Returns
Non-zero when the key is path-bearing, otherwise 0.

Definition at line 10 of file native_dynamic_config.c.

References streq().

Referenced by native_dynamic_config_resolve_value_dup().

◆ native_dynamic_config_lookup_raw_dup()

char * native_dynamic_config_lookup_raw_dup ( const char * conf_path,
const char * key )

Loads one raw dynamic config value from a config file when it exists.

Parameters
conf_pathConfig file path.
keyConfig key name.
Returns
Newly allocated raw value, or NULL when the key or file is missing.

Definition at line 33 of file native_dynamic_config.c.

References conf_lookup_value(), and path_exists().

Referenced by native_dynamic_config_merged_value_dup().

◆ native_dynamic_config_merged_value_dup()

char * native_dynamic_config_merged_value_dup ( const char * app_root,
const char * runtime_conf_path,
const char * key )

Loads one merged dynamic config value with runtime-conf precedence over app-local config.

Parameters
app_rootApp root directory.
runtime_conf_pathRuntime config path from the environment.
keyConfig key name.
Returns
Newly allocated resolved value, or NULL when the key is absent.

Definition at line 40 of file native_dynamic_config.c.

References app_local_conf_path_native(), native_dynamic_config_lookup_raw_dup(), and native_dynamic_config_resolve_value_dup().

Referenced by handle_dynamic_config_value_command(), load_postgresql_runtime_config_runtime_local(), native_dynamic_relational_backend_dup(), and native_dynamic_relational_sqlite_path_dup().

◆ native_dynamic_config_resolve_value_dup()

char * native_dynamic_config_resolve_value_dup ( const char * conf_path,
const char * key,
const char * raw_value )

Resolves one raw dynamic config value against its owning config file.

Parameters
conf_pathPath to the config file that supplied the value.
keyConfig key name.
raw_valueRaw config value.
Returns
Newly allocated resolved value, or NULL when no value is available.

Definition at line 19 of file native_dynamic_config.c.

References native_dynamic_config_key_is_path(), and resolve_conf_relative_path_native().

Referenced by native_dynamic_config_merged_value_dup().