Added config system

This commit is contained in:
Bofh 2021-11-25 14:33:49 +01:00
parent 381a188082
commit 15751325be
4 changed files with 20 additions and 0 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.*.swp .*.swp
config/config.php

View File

@ -0,0 +1,5 @@
<?php
$config = [
"site_name": "https://your-site.com",
];

View File

@ -24,6 +24,7 @@ services:
- ENV=dev # if not set, production mode is ON - ENV=dev # if not set, production mode is ON
volumes: volumes:
- ./public:/var/www/html - ./public:/var/www/html
- ./config:/config
- ./src:/src - ./src:/src
networks: networks:
- dev - dev

View File

@ -20,3 +20,16 @@ function l($key, $default='') {
echo $locales[$parts[0]][$parts[1]]; echo $locales[$parts[0]][$parts[1]];
else echo $default; else echo $default;
} }
# read config
$config = [];
if (file_exists('/config/config.php')) {
require_once '/config/config.php';
}
function conf($key, $default='') {
global $config;
if (isset($config[$key]))
return $config[$key];
return $default;
}