feat: change config file format to yaml

- docs: add link to yaml.org

BREAKING: The `ini` configuration file format changed to `yml`. Please
rewrite your configuration file using the yaml format.
This commit is contained in:
jo 2022-06-06 17:04:26 +02:00 committed by Kyle Robbertze
parent 5d902ef962
commit e4439390fe
11 changed files with 121 additions and 139 deletions

View file

@ -17,7 +17,7 @@ class Config
public static function loadConfig()
{
$filename = $_SERVER['LIBRETIME_CONFIG_FILEPATH'] ?? LIBRETIME_CONFIG_FILEPATH;
$values = parse_ini_file($filename, true);
$values = yaml_parse_file($filename);
$CC_CONFIG = [];
@ -28,7 +28,7 @@ class Config
// Explode public_url into multiple component with possible defaults for required fields
try {
$public_url = Uri::createFromString($values['general']['public_url']);
} catch (UriException $e) {
} catch (UriException|TypeError $e) {
echo 'could not parse configuration field general.public_url: ' . $e->getMessage();
exit;

View file

@ -29,6 +29,7 @@ php7.2-gd = bionic
php7.2-mbstring = bionic
php7.2-pgsql = bionic
php7.2-xml = bionic
php7.2-yaml = bionic
# Buster
[php7.3]
@ -44,6 +45,7 @@ php7.3-gd = buster
php7.3-mbstring = buster
php7.3-pgsql = buster
php7.3-xml = buster
php7.3-yaml = buster
# Bullseye, Focal
[php7.4]
@ -59,3 +61,4 @@ php7.4-gd = bullseye, focal
php7.4-mbstring = bullseye, focal
php7.4-pgsql = bullseye, focal
php7.4-xml = bullseye, focal
php7.4-yaml = bullseye, focal

View file

@ -1,11 +0,0 @@
[general]
dev_env = testing
public_url = http://localhost
api_key = H2NRICX6CM8F50CU123C
[database]
host = localhost
port = 5432
name = libretime_test
user = libretime
password = libretime

View file

@ -0,0 +1,11 @@
general:
dev_env: testing
public_url: http://localhost
api_key: H2NRICX6CM8F50CU123C
database:
host: localhost
port: 5432
name: libretime_test
user: libretime
password: libretime