aboutsummaryrefslogtreecommitdiffstats
path: root/config/dotenv.php
blob: 16d31af5e7fffe188d92fc00fa3f0bbe2f8e6b23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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 '';
    }
}