-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.php
113 lines (97 loc) · 4.17 KB
/
settings.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
<?php
declare(strict_types=1);
use DI\ContainerBuilder;
use Monolog\Logger;
return function (ContainerBuilder $containerBuilder) {
$doctrineConnectionOptions = [];
if (!in_array(getenv('APP_ENV'), ['local', 'test'])) {
$doctrineConnectionOptions[PDO::MYSQL_ATTR_SSL_CA] =
dirname(__DIR__) . '/deploy/rds-ca-eu-west-1-bundle.pem';
}
// Global Settings Object
$containerBuilder->addDefinitions([
'settings' => [
'apiClient' => [
'global' => [
'timeout' => getenv('SALESFORCE_CLIENT_TIMEOUT'), // in seconds
],
'campaign' => [
'baseUri' => getenv('SALESFORCE_CAMPAIGN_API'),
],
'donation' => [
'baseUri' => getenv('SALESFORCE_DONATION_API'),
],
'fund' => [
'baseUri' => getenv('SALESFORCE_FUND_API'),
],
'mailer' => [
'baseUri' => getenv('MAILER_BASE_URI'),
'sendSecret' => getenv('MAILER_SEND_SECRET'),
],
],
'appEnv' => getenv('APP_ENV'),
'displayErrorDetails' => (getenv('APP_ENV') === 'local'),
'doctrine' => [
// if true, metadata caching is forcefully disabled
'dev_mode' => in_array(getenv('APP_ENV'), ['local', 'test'], true),
'cache_dir' => __DIR__ . '/../var/doctrine',
'metadata_dirs' => [__DIR__ . '/../src/Domain'],
'connection' => [
'driver' => 'pdo_mysql',
'host' => getenv('MYSQL_HOST'),
'port' => 3306,
'dbname' => getenv('MYSQL_SCHEMA'),
'user' => getenv('MYSQL_USER'),
'password' => getenv('MYSQL_PASSWORD'),
'charset' => 'utf8mb4',
'defaultTableOptions' => [
'collate' => 'utf8mb4_unicode_ci',
],
'driverOptions' => $doctrineConnectionOptions,
],
],
'identity' => [
'baseUri' => getenv('ID_BASE_URI'),
],
'logger' => [
'name' => 'matchbot',
'path' => 'php://stdout',
'level' => getenv('APP_ENV') === 'local' ? Logger::DEBUG : Logger::INFO,
],
'los_rate_limit' => [
// Dynamic so we can increase it for load tests or as needed based on observed
// Production behaviour.
'ip_max_requests' => (int) (getenv('MAX_CREATES_PER_IP_PER_5M') ?: '1'),
'ip_reset_time' => 300, // 5 minutes
// All non-local envs, including 'test', assume ALB-style forwarded headers will be used.
'prefer_forwarded' => getenv('APP_ENV') !== 'local',
'trust_forwarded' => getenv('APP_ENV') !== 'local',
'forwarded_headers_allowed' => [
'X-Forwarded-For',
],
'hash_ips' => true, // Required for Redis storage of IPv6 addresses.
],
'notifier' => [
'slack' => [
'api_token' => getenv('SLACK_API_TOKEN'),
// e.g. '#matchbot' – channel for app's own general actions.
'channel' => getenv('SLACK_CHANNEL'),
// Override channel for administrative Stripe notifications.
'stripe_channel' => 'stripe',
],
],
'redis' => [
'host' => getenv('REDIS_HOST'),
],
'stripe' => [
'apiKey' => getenv('STRIPE_SECRET_KEY'),
'accountWebhookSecret' => getenv('STRIPE_WEBHOOK_SIGNING_SECRET'),
'connectAppWebhookSecret' => getenv('STRIPE_CONNECT_WEBHOOK_SIGNING_SECRET'),
],
'salesforce' => [
// authenticates requests originating from salesforce to matchbot:
'apiKey' => getenv('SALESFORCE_SECRET_KEY'),
]
],
]);
};