forked from userfrosting/UserFrosting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig-userfrosting-example.php
132 lines (123 loc) · 5.47 KB
/
config-userfrosting-example.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
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
// Set your timezone here
date_default_timezone_set('America/New_York');
// Do not send fatal errors to the response body!
ini_set("display_errors", "off");
/* Instantiate the Slim application */
$app = new \UserFrosting\UserFrosting([
'view' => new \Slim\Views\Twig(),
'mode' => 'dev' // Set to 'dev' or 'production'
]);
// Get file path to public directory for this website. Is this guaranteed to work in all environments?
$public_path = $_SERVER['DOCUMENT_ROOT'] . $app->environment()['SCRIPT_NAME'];
// Construct public URL (e.g. "http://www.userfrosting.com/admin"). Feel free to hardcode this if you feel safer.
$environment = $app->environment();
$serverport = (($environment['SERVER_PORT'] == 443) or ($environment['SERVER_PORT'] == 80)) ? '' : ':' . $environment['SERVER_PORT'];
$uri_public_root = $environment['slim.url_scheme'] . "://" . $environment['SERVER_NAME'] . $serverport . $environment['SCRIPT_NAME'];
/********* DEVELOPMENT SETTINGS *********/
$app->configureMode('dev', function () use ($app, $public_path, $uri_public_root) {
$app->config([
'log.enable' => true,
'debug' => false,
'base.path' => __DIR__,
'templates.path' => __DIR__ . '/templates', // This will be overridden anyway by the default theme.
'themes.path' => __DIR__ . '/templates/themes',
'plugins.path' => __DIR__ . '/plugins',
'schema.path' => __DIR__ . '/schema',
'locales.path' => __DIR__ . '/locale',
'log.path' => __DIR__ . '/log',
'public.path' => $public_path,
'js.path.relative' => "/js",
'css.path.relative' => "/css",
'session' => [
'name' => 'UserFrosting',
'cache_limiter' => false
],
'db' => [
'db_host' => 'localhost',
'db_name' => 'userfrosting',
'db_user' => 'admin',
'db_pass' => 'password',
'db_prefix'=> 'uf_'
],
'mail' => 'smtp',
'smtp' => [
'host' => 'mail.example.com',
'port' => 465,
'auth' => true,
'secure' => 'ssl',
'user' => '[email protected]',
'pass' => 'password'
],
'uri' => [
'public' => $uri_public_root,
'js-relative' => "/js",
'css-relative' => "/css",
'favicon-relative' => "/css/favicon.ico",
'image-relative' => "/images"
],
'user_id_guest' => 0,
'user_id_master' => 1,
'theme-base' => "default",
'theme-root' => "root"
]);
});
/********* PRODUCTION SETTINGS *********/
$app->configureMode('production', function () use ($app, $public_path, $uri_public_root) {
$app->config([
'log.enable' => true,
'debug' => false,
'base.path' => __DIR__,
'templates.path' => __DIR__ . '/templates',
'themes.path' => __DIR__ . '/templates/themes',
'plugins.path' => __DIR__ . '/plugins',
'schema.path' => __DIR__ . '/schema',
'locales.path' => __DIR__ . '/locale',
'log.path' => __DIR__ . '/log',
'public.path' => $public_path,
'js.path.relative' => "/js",
'css.path.relative' => "/css",
'session' => [
'name' => 'UserFrosting',
'cache_limiter' => false
],
'db' => [
'db_host' => 'localhost',
'db_name' => 'userfrosting',
'db_user' => 'admin',
'db_pass' => 'password',
'db_prefix'=> 'uf_'
],
'mail' => 'smtp',
'smtp' => [
'host' => 'mail.example.com',
'port' => 465,
'auth' => true,
'secure' => 'ssl',
'user' => '[email protected]',
'pass' => 'password'
],
'uri' => [
'public' => $uri_public_root,
'js-relative' => "/js",
'css-relative' => "/css",
'favicon-relative' => "/css/favicon.ico",
'image-relative' => "/images"
],
'user_id_guest' => 0,
'user_id_master' => 1,
'theme-base' => "default",
'theme-root' => "root"
]);
});
// Set up derived configuration values
$app->config([
'js.path' => $app->config('public.path') . $app->config('js.path.relative'),
'css.path' => $app->config('public.path') . $app->config('css.path.relative'),
'uri' => [
'js' => $app->config('uri')['public'] . $app->config('uri')['js-relative'],
'css' => $app->config('uri')['public'] . $app->config('uri')['css-relative'],
'favicon' => $app->config('uri')['public'] . $app->config('uri')['favicon-relative'],
'image' => $app->config('uri')['public'] . $app->config('uri')['image-relative'],
]
], true);