-
Notifications
You must be signed in to change notification settings - Fork 0
/
npm
78 lines (65 loc) · 2.56 KB
/
npm
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
declare(strict_types=1);
define('LION_START', microtime(true));
/**
* -----------------------------------------------------------------------------
* Register The Auto Loader
* -----------------------------------------------------------------------------
* Composer provides a convenient, automatically generated class loader for
* this application
* -----------------------------------------------------------------------------
**/
require_once(__DIR__ . '/vendor/autoload.php');
use Dotenv\Dotenv;
use Lion\Bundle\Commands\CommandHandler;
use Lion\Database\Driver;
use Lion\Files\Store;
define('IS_INDEX', false);
define('DEVELOPMENT_ENVIRONMENT', 'dev' === env('DEVELOPMENT_ENVIRONMENT'));
/**
* -----------------------------------------------------------------------------
* Register environment variable loader automatically
* -----------------------------------------------------------------------------
* .dotenv provides an easy way to access environment variables with $_ENV
* -----------------------------------------------------------------------------
**/
if (isSuccess((new Store())->exist(__DIR__ . '/.env'))) {
Dotenv::createImmutable(__DIR__)->load();
}
/**
* -----------------------------------------------------------------------------
* Database initialization
* -----------------------------------------------------------------------------
* */
Driver::run([
'default' => $_ENV['DB_NAME'],
'connections' => [
$_ENV['DB_NAME'] => [
'type' => $_ENV['DB_TYPE'],
'host' => $_ENV['DB_HOST'],
'port' => $_ENV['DB_PORT'],
'dbname' => $_ENV['DB_NAME'],
'user' => $_ENV['DB_USER'],
'password' => $_ENV['DB_PASSWORD']
],
$_ENV['DB_NAME_TEST'] => [
'type' => $_ENV['DB_TYPE_TEST'],
'host' => $_ENV['DB_HOST_TEST'],
'port' => $_ENV['DB_PORT_TEST'],
'dbname' => $_ENV['DB_NAME'],
'user' => $_ENV['DB_USER_TEST'],
'password' => $_ENV['DB_PASSWORD_TEST']
]
]
]);
/**
* -----------------------------------------------------------------------------
* Run The lion Application
* -----------------------------------------------------------------------------
* This is where the commands for your application are executed
* -----------------------------------------------------------------------------
**/
(new CommandHandler('Lion-Bundle'))
->registerCommands('./src/LionBundle/Commands/Npm/', 'Lion\\Bundle\\Commands\\Npm\\', 'Commands/Npm/')
->getApplication()
->run();