Pharos
0.7.23
Modern Web Framework & Web App Hosting Service.
Toggle main menu visibility
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
*/
12
typedef
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. */
25
}
AppLocalConfigNative
;
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
*/
36
char
*
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
*/
42
char
*
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
*/
49
char
*
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
*/
56
int
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
*/
61
void
free_app_local_config_native
(
AppLocalConfigNative
*config);
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
*/
67
char
*
normalize_base_path_native
(
const
char
*raw_value);
68
69
70
/** @} */
71
#endif
free_app_local_config_native
void free_app_local_config_native(AppLocalConfigNative *config)
Releases heap-owned fields in an app-local configuration record.
Definition
native_app_config.c:180
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.
Definition
native_app_config.c:44
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.
Definition
native_app_config.c:85
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.
Definition
native_app_config.c:20
normalize_base_path_native
char * normalize_base_path_native(const char *raw_value)
Normalizes a configured app base path into Pharos runtime form.
Definition
native_app_config.c:199
load_app_local_config_native
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.
Definition
native_app_config.c:120
AppLocalConfigNative
App-local configuration values loaded from app-local config and manifest authority fields.
Definition
native_app_config.h:12
AppLocalConfigNative::state_path
char * state_path
Definition
native_app_config.h:16
AppLocalConfigNative::manifest_base_path
char * manifest_base_path
Definition
native_app_config.h:24
AppLocalConfigNative::error_report_path
char * error_report_path
Definition
native_app_config.h:20
AppLocalConfigNative::base_path
char * base_path
Definition
native_app_config.h:17
AppLocalConfigNative::manifest_state_path
char * manifest_state_path
Definition
native_app_config.h:23
AppLocalConfigNative::log_path
char * log_path
Definition
native_app_config.h:18
AppLocalConfigNative::manifest_build_artifact_dir
char * manifest_build_artifact_dir
Definition
native_app_config.h:22
AppLocalConfigNative::build_dir
char * build_dir
Definition
native_app_config.h:14
AppLocalConfigNative::socket_path
char * socket_path
Definition
native_app_config.h:19
AppLocalConfigNative::state_dir
char * state_dir
Definition
native_app_config.h:15
AppLocalConfigNative::debug
char * debug
Definition
native_app_config.h:21
AppLocalConfigNative::conf_path
char * conf_path
Definition
native_app_config.h:13
src
native_runtime
c
native_app_config.h
Generated by
1.17.0