diff options
| author | Armand Philippot <git@armandphilippot.com> | 2021-10-30 22:44:55 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2021-10-30 23:09:33 +0200 |
| commit | 815b190d28cc42e6f3d44d04e1f1ebaea9208cf6 (patch) | |
| tree | 0d3f0133a39a4a796e698d360dc32f54fb41d8ad /config/dotenv.php | |
| parent | 3a3baddad1c801d77dc398d2c6980f3c14f4a47c (diff) | |
chore: convert html files to php
Now I can use php to determine current env and load static CSS file if
it is prod.
Diffstat (limited to 'config/dotenv.php')
| -rw-r--r-- | config/dotenv.php | 20 |
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 ''; + } +} |
