Download api/utils/Config.php from felix-fx/fx-craft: direct link, hf CLI and curl.
- Browser
- Download file 597 Bytes
-
https://huggingface.co/spaces/felix-fx/fx-craft/resolve/main/api/utils/Config.php
- Command line
-
hf download hf://spaces/felix-fx/fx-craft/api/utils/Config.php
-
curl -L -o Config.php https://huggingface.co/spaces/felix-fx/fx-craft/resolve/main/api/utils/Config.php
597 Bytes
| // /api/utils/Config.php | |
| class Config { | |
| private static $env = []; | |
| public static function load(string $path) { | |
| if (!file_exists($path)) return; | |
| $lines = file($path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); | |
| foreach ($lines as $line) { | |
| if (strpos(trim($line), '#') === 0) continue; | |
| list($name, $value) = explode('=', $line, 2); | |
| self::$env[trim($name)] = trim($value); | |
| } | |
| } | |
| public static function get(string $key, $default = null) { | |
| return self::$env[$key] ?? getenv($key) ?: $default; | |
| } | |
| } | |