aboutsummaryrefslogtreecommitdiffstats
path: root/config/dotenv.php
diff options
context:
space:
mode:
Diffstat (limited to 'config/dotenv.php')
-rw-r--r--config/dotenv.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/config/dotenv.php b/config/dotenv.php
new file mode 100644
index 0000000..16d31af
--- /dev/null
+++ b/config/dotenv.php
@@ -0,0 +1,20 @@
+<?php
+/**
+ * Get current environment defined in .env file.
+ *
+ * @since 1.2.0
+ *
+ * @return string Current env or empty string.
+ */
+function dap_get_current_env()
+{
+ if (file_exists(__DIR__ . '/vendor/autoload.php')) {
+ require_once __DIR__ . '/vendor/autoload.php';
+ $dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
+ $dotenv->safeLoad();
+ $current_env = $_ENV['CURRENT_ENV'];
+ return $current_env;
+ } else {
+ return '';
+ }
+}