-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·44 lines (33 loc) · 2 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/**
██╗███╗ ██╗██████╗ ███████╗██╗ ██╗ ██╗███╗ ██╗██╗████████╗
██║████╗ ██║██╔══██╗██╔════╝╚██╗██╔╝ ██║████╗ ██║██║╚══██╔══╝
██║██╔██╗ ██║██║ ██║█████╗ ╚███╔╝ ██║██╔██╗ ██║██║ ██║
██║██║╚██╗██║██║ ██║██╔══╝ ██╔██╗ ██║██║╚██╗██║██║ ██║
██║██║ ╚████║██████╔╝███████╗██╔╝ ██╗ ██║██║ ╚████║██║ ██║
╚═╝╚═╝ ╚═══╝╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝
* @author ©Towns.cz
* @fileOverview Initialization file
*/
//======================================================================================================================
// Config autoloader - get all files from config folder
foreach(scandir(__DIR__."/config") as $config_file)
{
// and if the file is .json, then
if (($offset = strlen($config_file) - strlen(".json")) >= 0 && strpos($config_file, ".json", $offset) !== FALSE)
{
// load it to config array
$name = substr($config_file, 0, $offset);
$config[$name] = json_decode(file_get_contents(__DIR__."/config/".$config_file), true);
}
}
//force production enviroment
if(isset($_GET['production'])){
$config['app']['environment']='production';
}
// load the app based on configuration environment
if(isset($config['app']['environment']) && in_array($config['app']['environment'], ["develop", "test"])){
require('app/index.php');
} else {
require('app-build/index.php');
}