From 2f79716a197f8ee7c9e901626f3c2967e63b9e68 Mon Sep 17 00:00:00 2001 From: Aldarien Date: Mon, 15 Mar 2021 17:41:48 -0300 Subject: [PATCH] Common setup --- setup/common/settings.php | 7 +++++++ setup/env/settings.php | 30 ++++++++++++++++++++++++++++++ setup/env/setups.php | 6 ++++++ 3 files changed, 43 insertions(+) create mode 100644 setup/common/settings.php create mode 100644 setup/env/settings.php create mode 100644 setup/env/setups.php diff --git a/setup/common/settings.php b/setup/common/settings.php new file mode 100644 index 0000000..9bdb688 --- /dev/null +++ b/setup/common/settings.php @@ -0,0 +1,7 @@ + function() { + $arr = ['base' => dirname(__DIR__, 2)]; + return (object) $arr; + } +]; diff --git a/setup/env/settings.php b/setup/env/settings.php new file mode 100644 index 0000000..40c733f --- /dev/null +++ b/setup/env/settings.php @@ -0,0 +1,30 @@ + +load(); + +return [ + 'debug' => $_ENV['DEBUG'], + 'databases' => function() { + $default = [ + 'system' => 'mysql', + 'host' => (object) [ + 'name' => $_ENV['DB_HOST'] ?? 'localhost' + ], + 'user' => (object) [ + 'name' => $_ENV['DB_USER'] ?? 'money', + 'password' => $_ENV['DB_PASSWORD'] ?? 'password' + ], + 'name' => $_ENV['DB_NAME'] ?? 'money' + ]; + if (isset($_ENV['DB_PORT'])) { + $default['host']->port = $_ENV['DB_PORT']; + } + $arr = [ + 'short_names' => true, + 'default' => (object) $default + ]; + return (object) $arr; + } +]; diff --git a/setup/env/setups.php b/setup/env/setups.php new file mode 100644 index 0000000..9569a4e --- /dev/null +++ b/setup/env/setups.php @@ -0,0 +1,6 @@ +