summaryrefslogtreecommitdiff
path: root/src/Config.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Config.php')
-rw-r--r--src/Config.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Config.php b/src/Config.php
new file mode 100644
index 0000000..06b32d0
--- /dev/null
+++ b/src/Config.php
@@ -0,0 +1,19 @@
+<?php
+
+namespace ERPHP;
+
+class Config
+{
+ public static function load(): void
+ {
+ $_ENV = array_replace_recursive(
+ $_ENV,
+ json_decode(file_get_contents(dirname(__DIR__) . "/config.json"), true) ?: []
+ );
+ }
+
+ public static function get(string $key, mixed $default = null): mixed
+ {
+ return $_ENV[$key] ?? getenv($key) === false ? $default : getenv($key);
+ }
+}