diff options
| author | Gab <24553253+gabrix73@users.noreply.github.com> | 2026-08-13 14:04:30 +0200 |
|---|---|---|
| committer | Gab <24553253+gabrix73@users.noreply.github.com> | 2026-08-13 14:04:30 +0200 |
| commit | 994071243fc80990cf09e820b671006e9bd31c76 (patch) | |
| tree | b65e02724b98033240aa6f9d153acea021abc456 /yamn_config.php | |
| parent | 47d903de3bca4165e96d6ec8830eafbacf524cd2 (diff) | |
| download | yamnweb-994071243fc80990cf09e820b671006e9bd31c76.tar.gz yamnweb-994071243fc80990cf09e820b671006e9bd31c76.tar.xz yamnweb-994071243fc80990cf09e820b671006e9bd31c76.zip | |
Separate active YAMN code from Katzenpost PoC
Diffstat (limited to 'yamn_config.php')
| -rw-r--r-- | yamn_config.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/yamn_config.php b/yamn_config.php new file mode 100644 index 0000000..2959736 --- /dev/null +++ b/yamn_config.php @@ -0,0 +1,15 @@ +<?php +declare(strict_types=1); + +function yamnConfig(string $key, string $fallback = ''): string +{ + $path = getenv('YAMN_CONFIG_FILE') ?: '/etc/yamnweb/yamnweb.env'; + if (!is_readable($path)) { + return getenv($key) !== false ? (string)getenv($key) : $fallback; + } + $values = parse_ini_file($path, false, INI_SCANNER_RAW); + if (!is_array($values) || !isset($values[$key]) || !is_string($values[$key])) { + return getenv($key) !== false ? (string)getenv($key) : $fallback; + } + return trim($values[$key]); +} |
