Go to the source code of this file.
|
| int | env_load (const char *path) |
| | Load environment variables from a .env file.
|
| |
| const char * | env_get (const char *key) |
| | Get value of a loaded environment variable.
|
| |
| int | env_inject_all (int overwrite) |
| | Inject all loaded environment variables into the process environment.
|
| |
| void | env_free (void) |
| | Free all loaded environment variable data.
|
| |
◆ env_free()
Free all loaded environment variable data.
Free all loaded environment variable data.
◆ env_get()
| const char * env_get |
( |
const char * | key | ) |
|
Get value of a loaded environment variable.
- Parameters
-
| key | Environment variable key. |
- Returns
- Value string or NULL if not found.
Get value of a loaded environment variable.
- Parameters
-
| key | Environment variable key. |
- Returns
- Value string or NULL if not found.
◆ env_inject_all()
| int env_inject_all |
( |
int | overwrite | ) |
|
Inject all loaded environment variables into the process environment.
- Parameters
-
| overwrite | Nonzero to overwrite existing system variables. |
- Returns
- 0 on success, -1 on failure.
Inject all loaded environment variables into the process environment.
- Parameters
-
| overwrite | Nonzero to overwrite existing system variables. |
- Returns
- 0 on success, -1 on error.
◆ env_load()
| int env_load |
( |
const char * | path | ) |
|
Load environment variables from a .env file.
- Parameters
-
- Returns
- 0 on success, -1 on failure.
Lines beginning with # are treated as comments and ignored. Keys and values are separated by =.
- Parameters
-
- Returns
- 0 on success, -1 on error (file not found, allocation failure, etc.).