Pharos 0.7.23
Modern Web Framework & Web App Hosting Service.
Loading...
Searching...
No Matches
native_app_config.h
Go to the documentation of this file.
1/**
2 * @file
3 * @brief Declares app-local runtime configuration helpers and the app-local configuration record.
4 */
5
6#ifndef PHAROS_NATIVE_APP_CONFIG_H
7#define PHAROS_NATIVE_APP_CONFIG_H
8
9/**
10 * @brief App-local configuration values loaded from app-local config and manifest authority fields.
11 */
12typedef struct {
13 char *conf_path; /**< App-local configuration file path. */
14 char *build_dir; /**< Build directory override from local config. */
15 char *state_dir; /**< State directory override from local config. */
16 char *state_path; /**< State file override from local config. */
17 char *base_path; /**< Base path override from local config. */
18 char *log_path; /**< Log path override from local config. */
19 char *socket_path; /**< Socket path override from local config. */
20 char *error_report_path; /**< Error report path override from local config. */
21 char *debug; /**< Debug flag override from local config. */
22 char *manifest_build_artifact_dir; /**< Build artifact dir authority extracted from the manifest. */
23 char *manifest_state_path; /**< State path authority extracted from the manifest. */
24 char *manifest_base_path; /**< Base path authority extracted from the manifest. */
26
27/** @name App-local configuration helpers
28 * @{
29 */
30/**
31 * @brief Resolves a config value relative to the directory that owns a config file.
32 * @param conf_path Path to the config file that supplied the value.
33 * @param raw_value Raw config value to resolve.
34 * @return Newly allocated resolved path, or NULL when no path can be produced.
35 */
36char *resolve_conf_relative_path_native(const char *conf_path, const char *raw_value);
37/**
38 * @brief Builds the path to an app-local runtime configuration file.
39 * @param app_root Root directory of the Pharos app.
40 * @return Newly allocated config path, or NULL on allocation failure.
41 */
42char *app_local_conf_path_native(const char *app_root);
43/**
44 * @brief Looks up one key from the app-local runtime configuration.
45 * @param app_root Root directory of the Pharos app.
46 * @param key Configuration key to read.
47 * @return Newly allocated value string, or NULL when the key is not present or cannot be read.
48 */
49char *app_local_conf_value_native(const char *app_root, const char *key);
50/**
51 * @brief Loads app-local configuration and manifest-derived path hints into a config record.
52 * @param app_root Root directory of the Pharos app.
53 * @param config Destination record to populate.
54 * @return 0 on success, or a non-zero native status code on failure.
55 */
56int load_app_local_config_native(const char *app_root, AppLocalConfigNative *config);
57/**
58 * @brief Releases heap-owned fields in an app-local configuration record.
59 * @param config Configuration record to clear.
60 */
62/**
63 * @brief Normalizes a configured app base path into Pharos runtime form.
64 * @param raw_value Raw base path text from config or manifest data.
65 * @return Newly allocated normalized base path, or NULL on failure.
66 */
67char *normalize_base_path_native(const char *raw_value);
68
69
70/** @} */
71#endif
void free_app_local_config_native(AppLocalConfigNative *config)
Releases heap-owned fields in an app-local configuration record.
char * app_local_conf_path_native(const char *app_root)
Builds the path to an app-local runtime configuration file.
char * app_local_conf_value_native(const char *app_root, const char *key)
Looks up one key from the app-local runtime configuration.
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 * normalize_base_path_native(const char *raw_value)
Normalizes a configured app base path into Pharos runtime form.
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.
App-local configuration values loaded from app-local config and manifest authority fields.