diff --git a/.gitignore b/.gitignore index 813e987..98e0a01 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .env.local +env.local.php .local/ uploads/ var/ diff --git a/app/bootstrap.php b/app/bootstrap.php index 018d5de..de8f55f 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -6,6 +6,17 @@ if (!defined('APP_ROOT')) { define('APP_ROOT', dirname(__DIR__)); } +// Auf echtem Webhosting (PHP-FPM/mod_php) gibt es meist keine bequeme +// Moeglichkeit, Prozess-Umgebungsvariablen zu setzen wie beim lokalen +// `source .env.local` vor dem PHP-Dev-Server. env.local.php ist die +// Produktions-Entsprechung: eine nicht eingecheckte Datei mit putenv()- +// Aufrufen, siehe env.local.example.php. Existiert sie nicht (lokale +// Entwicklung), passiert hier nichts und getenv() liest wie bisher aus +// der Shell-Umgebung. +if (is_file(APP_ROOT . '/env.local.php')) { + require_once APP_ROOT . '/env.local.php'; +} + function app_env(string $name, ?string $default = null): ?string { $value = getenv($name); diff --git a/env.local.example.php b/env.local.example.php new file mode 100644 index 0000000..c169840 --- /dev/null +++ b/env.local.example.php @@ -0,0 +1,48 @@ +