Added config system
This commit is contained in:
parent
381a188082
commit
15751325be
|
@ -1 +1,2 @@
|
||||||
.*.swp
|
.*.swp
|
||||||
|
config/config.php
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$config = [
|
||||||
|
"site_name": "https://your-site.com",
|
||||||
|
];
|
|
@ -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
|
||||||
|
|
13
src/base.php
13
src/base.php
|
@ -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;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue