mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 09:37:26 +00:00
28 lines
588 B
PHP
28 lines
588 B
PHP
<?php
|
|
|
|
class Config
|
|
{
|
|
protected static $loaded = false;
|
|
protected static $data = [];
|
|
|
|
public static function get($name, $default = null)
|
|
{
|
|
static::load();
|
|
return array_key_exists($name, static::$data) ? static::$data[$name] : $default;
|
|
}
|
|
|
|
|
|
protected static function load()
|
|
{
|
|
if (!static::$loaded)
|
|
{
|
|
$dataFile = ROOT_DIR.'/data/config.php';
|
|
if (!is_readable($dataFile))
|
|
{
|
|
throw new RuntimeException('config file is missing or not readable');
|
|
}
|
|
static::$data = require $dataFile;
|
|
static::$loaded = true;
|
|
}
|
|
}
|
|
}
|