Repository navigation
Expand file tree
/
Copy pathconfig.dev.php
More file actions
186 lines (161 loc) · 8.05 KB
/
Copy pathconfig.dev.php
File metadata and controls
186 lines (161 loc) · 8.05 KB
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<?php
date_default_timezone_set('America/Chicago');
define('CONFIG', true);
error_reporting(E_ALL);
ini_set('display_errors', '1');
// HTTP
define('ORK_DIST_NAME', '');
// Scheme-aware so the same dev config serves plain-http localhost AND the
// TLS-terminated staging host (Cloudflare/nginx set X-Forwarded-Proto);
// hardcoded http:// there would put http links, og:url and canonicals on
// an https page.
$_scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
|| (($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '') === 'https') ? 'https' : 'http';
define('HTTP_SERVICE', $_scheme . '://' . $_SERVER['HTTP_HOST'] . '/orkservice/');
define('HTTP_UI', $_scheme . '://' . $_SERVER['HTTP_HOST'] . '/orkui/');
define('HTTP_UI_REMOTE', $_scheme . '://' . $_SERVER['HTTP_HOST'] . '/orkui/');
define('HTTP_TEMPLATE', HTTP_UI . 'template/');
define('HTTP_ASSETS', $_scheme . '://' . $_SERVER['HTTP_HOST'] . '/assets/');
define('HTTP_WAIVERS', $_scheme . '://' . $_SERVER['HTTP_HOST'] . '/assets/waivers/');
define('HTTP_HERALDRY', $_scheme . '://' . $_SERVER['HTTP_HOST'] . '/assets/heraldry/');
define('HTTP_PLAYER_IMAGE', $_scheme . '://' . $_SERVER['HTTP_HOST'] . '/assets/players/');
define('HTTP_PLAYER_HERALDRY', HTTP_HERALDRY . 'player/');
define('HTTP_PARK_HERALDRY', HTTP_HERALDRY . 'park/');
define('HTTP_KINGDOM_HERALDRY', HTTP_HERALDRY . 'kingdom/');
define('HTTP_EVENT_HERALDRY', HTTP_HERALDRY . 'event/');
define('HTTP_EVENT_BANNER', HTTP_HERALDRY . 'event-banner/');
define('HTTP_PARK_BANNER', HTTP_HERALDRY . 'park-banner/');
define('HTTP_KINGDOM_BANNER', HTTP_HERALDRY . 'kingdom-banner/');
define('HTTP_PLAYER_BANNER', HTTP_HERALDRY . 'player-banner/');
define('HTTP_UNIT_BANNER', HTTP_HERALDRY . 'unit-banner/');
define('HTTP_UNIT_HERALDRY', HTTP_HERALDRY . 'unit/');
define('HERALDRY_PLAYER_DEFAULT', HTTP_PLAYER_HERALDRY . '000000.jpg');
define('HERALDRY_PARK_DEFAULT', HTTP_PARK_HERALDRY . '00000.jpg');
define('HERALDRY_KINGDOM_DEFAULT', HTTP_KINGDOM_HERALDRY . '0000.jpg');
define('HERALDRY_EVENT_DEFAULT', HTTP_EVENT_HERALDRY . '00000.jpg');
define('HERALDRY_UNIT_DEFAULT', HTTP_UNIT_HERALDRY . '00000.jpg');
// HTTPS
define('HTTPS_SERVICE', "https://{$_SERVER['HTTP_HOST']}/orkservice/");
define('HTTPS_UI', "https://{$_SERVER['HTTP_HOST']}/orkui/");
// DIR
define('DIR_BASENAME', dirname(__FILE__) . '/');
define('DIR_SERVICE', DIR_BASENAME . "orkservice/");
define('DIR_UI', DIR_BASENAME . "orkui/");
define('DIR_SYSTEM', DIR_BASENAME . "system/");
define('DIR_ASSETS', DIR_BASENAME . "assets/");
define('DIR_TMP', DIR_ASSETS . 'tmp/');
define('DIR_WAIVERS', DIR_ASSETS . "waivers/");
define('DIR_HERALDRY', DIR_ASSETS . "heraldry/");
define('DIR_PLAYER_IMAGE', DIR_ASSETS . "players/");
define('DIR_PLAYER_HERALDRY', DIR_HERALDRY . "player/");
define('DIR_PARK_HERALDRY', DIR_HERALDRY . "park/");
define('DIR_KINGDOM_HERALDRY', DIR_HERALDRY . "kingdom/");
define('DIR_EVENT_HERALDRY', DIR_HERALDRY . "event/");
define('DIR_EVENT_BANNER', DIR_HERALDRY . "event-banner/");
define('DIR_PARK_BANNER', DIR_HERALDRY . "park-banner/");
define('DIR_KINGDOM_BANNER', DIR_HERALDRY . "kingdom-banner/");
define('DIR_PLAYER_BANNER', DIR_HERALDRY . "player-banner/");
define('DIR_UNIT_BANNER', DIR_HERALDRY . "unit-banner/");
define('DIR_UNIT_HERALDRY', DIR_HERALDRY . "unit/");
define('DIR_CACHE', DIR_BASENAME . 'cache/');
// System
define('DIR_LIB', DIR_SYSTEM . 'lib/');
define('DIR_ORK3', DIR_LIB . 'ork3/');
define('DIR_SYSTEMLIB', DIR_LIB . 'system/');
define('DIR_LOGS', DIR_SYSTEM . 'logs/');
// UI
define('DIR_CONTROLLER', DIR_UI . 'controller/');
define('DIR_LANGUAGE', DIR_UI . 'language/');
define('DIR_TEMPLATE', DIR_UI . 'template/');
define('DIR_VIEW', DIR_UI . 'view/');
define('DIR_MODEL', DIR_UI . 'model/');
// DB — profile switching via bin/ork-db use prod|dev (.ork3-db.local)
$ork3DbProfileFile = dirname(__FILE__) . '/.ork3-db.local';
if (is_readable($ork3DbProfileFile)) {
foreach (file($ork3DbProfileFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line) {
$line = trim($line);
if ($line === '' || str_starts_with($line, '#')) {
continue;
}
if (str_contains($line, '=')) {
[$name, $value] = explode('=', $line, 2);
putenv(trim($name) . '=' . trim($value));
}
}
}
$ork3DbProfile = getenv('ORK3_DB_PROFILE') ?: 'prod';
// Env-overridable so the same config serves a local checkout (defaults
// match docker-compose.php8.yml) and the staging stack (real password,
// ork3-stage-* container names — see docker-compose.staging.yml).
define('DB_DRIVER', 'mysql');
define('DB_USERNAME', getenv('ORK3_DB_USER') ?: 'ork');
define('DB_PASSWORD', getenv('ORK3_DB_PASSWORD') ?: 'secret');
define('DB_PREFIX', 'ork_');
if ($ork3DbProfile === 'dev') {
define('DB_HOSTNAME', 'ork3-php8-test-db');
define('DB_DATABASE', 'ork_test');
} else {
define('DB_HOSTNAME', getenv('ORK3_DB_HOST') ?: 'ork3-php8-db');
define('DB_DATABASE', getenv('ORK3_DB_DATABASE') ?: 'ork');
}
define('CACHE_HOST', 'ork-dev');
define('CUSTOM_CSS', HTTP_TEMPLATE . 'default/style/custom.css');
// System Config
define('LOGIN_TIMEOUT', 30 * 24 * 60 * 60);
define('APP_STAGE', 'DEV');
define('UI_LOCALITY', 'LOCAL'); // REMOTE
define('ORK3_SERVICE_URL', HTTP_SERVICE);
define('SETUP_ADMIN_EMAIL', 'youremail@example.com');
define('DO_SETUP', false);
define('TRACE', false);
define('DUMPTRACE', false);
define('GOOGLE_MAPS_API_KEY', '');
define('GOOGLE_MAPS_ACCESS_API_KEY', '');
define('SENDGRID_API_KEY', '');
define('BEHOLD_KEY', '');
// Cloudflare analytics — keep empty in committed config.dev.php. For local
// testing pass via docker (-e CF_API_TOKEN=… -e CF_ZONE_ID=…) — the recap
// code falls back to getenv() when the constants are empty.
define('CF_API_TOKEN', '');
define('CF_ZONE_ID', '');
// Amazon SES SMTP — same env var names as Amtgard IDP (.env / ORK .dev.env).
// heartbeat.sh passes these into php-fpm when set on the container.
//
// This is the outbound mail path for password reset (Authorization::ResetPassword).
// Leave empty here; the real values live in prod config.php. With these empty a
// reset request fails cleanly and is logged instead of sending mail.
//
// Defined ONCE, here. A second plain-empty block added above these on 2026-10-09
// re-declared HOST/USERNAME/PASSWORD; PHP keeps the FIRST define() and warns, so
// the earlier block won and these getenv() reads were dead for those three.
define('AMAZON_SES_HOST', getenv('AMAZON_SES_HOST') ?: '');
define('AMAZON_SES_USERNAME', getenv('AMAZON_SES_USERNAME') ?: '');
define('AMAZON_SES_PASSWORD', getenv('AMAZON_SES_PASSWORD') ?: '');
define('AMAZON_SES_FROM_EMAIL', getenv('AMAZON_SES_FROM_EMAIL') ?: '');
$amazonSesPort = getenv('AMAZON_SES_PORT');
define('AMAZON_SES_PORT', ($amazonSesPort !== false && trim((string) $amazonSesPort) !== '')
? (int) $amazonSesPort
: 587);
// CARTO basemap tile key (Live Attendance + Weather maps) — keep empty in
// committed config.dev.php; set the real value in an untracked local
// override if you need working maps locally.
define('CARTO_API_KEY', '');
// INCLUDE
require_once(DIR_LIB . 'mail.php');
require_once(DIR_LIB . 'Yapo2/class.Yapo.php');
require_once(DIR_SYSTEMLIB . 'class.Log.php');
define('CACHE_ENABLED', true);
// For development purposes due to containerization, the frontend (browser) and backend need different endpoints
// In production, the same endpoint will suffice (https://idp.amtgard.com)
// Who the ORK is when it calls another service. Not destination-specific --
// reuse this for any future outbound integration.
define('ORK_CLIENT_NAME', 'AmtgardORK');
// Key the IDP accepts from the ORK. Per-relationship, so it lives with the
// other IDP_* settings. idp.amtgard.com is behind the same Cloudflare zone as
// the ORK, and a server-side POST is challenged without a skip rule matching
// this key. Empty locally (no Cloudflare in front of a local IDP).
define('IDP_API_KEY', getenv('IDP_API_KEY') ?: '');
define('IDP_BASE_URL', 'http://localhost:37080');
define('IDP_API_URL', 'http://host.docker.internal:37080');
define('IDP_CLIENT_ID', 'ork3_dev');
define('IDP_CLIENT_SECRET', 'tt8TTMfSkVUf9fwCdmi8b6G6BCnwVUgB');