-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.php
62 lines (50 loc) · 2.51 KB
/
config.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
<?php
/**
* Common configuration file which should be included by every application in the project.
*
* @package Common
*/
use YapepBase\Config;
Config::getInstance()->set(
array(
// General config
'system.project.name' => PROJECT_NAME,
// Session
'resource.session.www.namespace' => 'www',
'resource.session.www.cookieName' => 'session',
'resource.session.www.lifetime' => 1800, // 30 minutes
'resource.storage.session.storageType' => 'saslMemcached',
'resource.storage.session.host' => preg_replace('/:.+$/', '', getenv('MEMCACHIER_SERVERS')),
'resource.storage.session.port' => preg_replace('/^.+:/', '', getenv('MEMCACHIER_SERVERS')),
'application.passwordHash.cost' => 10,
'resource.vend.oauth.clientId' => getenv('VEND_OAUTH_CLIENT_ID'),
'resource.vend.oauth.clientSecret' => getenv('VEND_OAUTH_CLIENT_SECRET'),
'resource.vend.oauth.redirectUri' => getenv('VEND_OAUTH_REDIRECT_URI'),
)
);
Config::getInstance()->set('application.debuggerEnabled', (bool)getenv('IS_TEST_ENVIRONMENT'));
// TODO do this in a nicer way in yapep 1.0
function setupMySqlDbConfig($varName, $dbName)
{
$parsed = parse_url(getenv($varName));
$config = Config::getInstance();
$config->set(
[
'resource.database.' . $dbName . '.rw.backendType' => 'mysql',
'resource.database.' . $dbName . '.rw.host' => $parsed['host'],
'resource.database.' . $dbName . '.rw.user' => $parsed['user'],
'resource.database.' . $dbName . '.rw.password' => $parsed['pass'],
'resource.database.' . $dbName . '.rw.database' => ltrim($parsed['path'], '/'),
'resource.database.' . $dbName . '.rw.port' => $parsed['port'],
'resource.database.' . $dbName . '.rw.charset' => 'utf8',
'resource.database.' . $dbName . '.ro.backendType' => 'mysql',
'resource.database.' . $dbName . '.ro.host' => $parsed['host'],
'resource.database.' . $dbName . '.ro.user' => $parsed['user'],
'resource.database.' . $dbName . '.ro.password' => $parsed['pass'],
'resource.database.' . $dbName . '.ro.database' => ltrim($parsed['path'], '/'),
'resource.database.' . $dbName . '.ro.port' => $parsed['port'],
'resource.database.' . $dbName . '.ro.charset' => 'utf8',
]
);
}
setupMySqlDbConfig('JAWSDB_URL', 'vend');