Pharos 0.7.23
Modern Web Framework & Web App Hosting Service.
Loading...
Searching...
No Matches
native_app_config.c File Reference

Loads app-local runtime configuration and resolves app-relative override paths from local config and manifest data. More...

#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.

Macros

#define pharos_app_config_strdup   strdup

Functions

char * resolve_conf_relative_path_native (const char *conf_path, const char *raw_value)
 Resolves a config value relative to the directory that owns a config file.
char * app_local_conf_path_native (const char *app_root)
 Builds the path to an app-local runtime configuration file.
static char * resolve_conf_value_key_native (const char *conf_path, const char *key, const char *value)
static char * duplicate_config_field_native (const AppLocalConfigNative *config, size_t offset)
char * app_local_conf_value_native (const char *app_root, const char *key)
 Looks up one key from the app-local runtime configuration.
int load_app_local_config_native (const char *app_root, AppLocalConfigNative *config)
 Loads app-local configuration and manifest-derived path hints into a config record.
void free_app_local_config_native (AppLocalConfigNative *config)
 Releases heap-owned fields in an app-local configuration record.
char * normalize_base_path_native (const char *raw_value)
 Normalizes a configured app base path into Pharos runtime form.

Detailed Description

Loads app-local runtime configuration and resolves app-relative override paths from local config and manifest data.

Definition in file native_app_config.c.

Macro Definition Documentation

◆ pharos_app_config_strdup

#define pharos_app_config_strdup   strdup

Function Documentation

◆ app_local_conf_path_native()

char * app_local_conf_path_native ( const char * app_root)

Builds the path to an app-local runtime configuration file.

Parameters
app_rootRoot directory of the Pharos app.
Returns
Newly allocated config path, or NULL on allocation failure.

Definition at line 44 of file native_app_config.c.

References path_exists(), and path_join().

Referenced by dynamic_merged_config_value_runtime(), load_app_local_config_native(), native_dynamic_config_merged_value_dup(), and resolved_runtime_conf_path_from_config_native().

◆ app_local_conf_value_native()

char * app_local_conf_value_native ( const char * app_root,
const char * key )

Looks up one key from the app-local runtime configuration.

Parameters
app_rootRoot directory of the Pharos app.
keyConfiguration key to read.
Returns
Newly allocated value string, or NULL when the key is not present or cannot be read.

Definition at line 85 of file native_app_config.c.

References duplicate_config_field_native(), free_app_local_config_native(), load_app_local_config_native(), and streq().

◆ duplicate_config_field_native()

char * duplicate_config_field_native ( const AppLocalConfigNative * config,
size_t offset )
static

Definition at line 73 of file native_app_config.c.

References pharos_app_config_strdup.

Referenced by app_local_conf_value_native().

◆ free_app_local_config_native()

◆ load_app_local_config_native()

◆ normalize_base_path_native()

char * normalize_base_path_native ( const char * raw_value)

Normalizes a configured app base path into Pharos runtime form.

Parameters
raw_valueRaw base path text from config or manifest data.
Returns
Newly allocated normalized base path, or NULL on failure.

Definition at line 199 of file native_app_config.c.

References len, pharos_app_config_strdup, and streq().

Referenced by app_base_path_local_native(), and effective_app_base_path_native().

◆ resolve_conf_relative_path_native()

char * resolve_conf_relative_path_native ( const char * conf_path,
const char * raw_value )

Resolves a config value relative to the directory that owns a config file.

Parameters
conf_pathPath to the config file that supplied the value.
raw_valueRaw config value to resolve.
Returns
Newly allocated resolved path, or NULL when no path can be produced.

Definition at line 20 of file native_app_config.c.

References path_dirname(), path_join(), and pharos_app_config_strdup.

Referenced by native_dynamic_config_resolve_value_dup(), resolve_conf_value_key_native(), resolve_dynamic_config_value_runtime(), and runtime_apps_dir_native().

◆ resolve_conf_value_key_native()

char * resolve_conf_value_key_native ( const char * conf_path,
const char * key,
const char * value )
static