mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2025-03-13 05:51:10 +00:00
add Environment library
This commit is contained in:
parent
6b112d441c
commit
e1054cd69e
27
src/library/environment.php
Normal file
27
src/library/environment.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
class Environment
|
||||
{
|
||||
public static function config(string $name) : object
|
||||
{
|
||||
$config = __DIR__ . '/../config/' . $name . '.json';
|
||||
|
||||
if (file_exists(__DIR__ . '/../config/.env'))
|
||||
{
|
||||
$environment = file_get_contents(__DIR__ . '/../config/.env');
|
||||
|
||||
$filename = __DIR__ . '/../config/' . $environment . '/' . $name . '.json';
|
||||
|
||||
if (file_exists($filename))
|
||||
{
|
||||
$config = $filename;
|
||||
}
|
||||
}
|
||||
|
||||
return json_decode(
|
||||
file_get_contents(
|
||||
$config
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user