First commit
This commit is contained in:
commit
f0591a20ab
71 changed files with 5682 additions and 0 deletions
31
api/brevo-config.php
Normal file
31
api/brevo-config.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
// Load environment variables from .env file
|
||||
$env_file = __DIR__ . '/.env';
|
||||
|
||||
if (file_exists($env_file)) {
|
||||
$lines = file($env_file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
foreach ($lines as $line) {
|
||||
if (strpos(trim($line), '#') === 0) continue;
|
||||
|
||||
if (strpos($line, '=') !== false) {
|
||||
list($key, $value) = explode('=', $line, 2);
|
||||
$key = trim($key);
|
||||
$value = trim($value, '"\'');
|
||||
|
||||
putenv("$key=$value");
|
||||
$_ENV[$key] = $value;
|
||||
$_SERVER[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
define('BREVO_API_KEY', getenv('BREVO_API_KEY') ?: '');
|
||||
define('BREVO_LIST_ID', (int)(getenv('BREVO_LIST_ID') ?: 2)); // Must be int, not string
|
||||
define('BREVO_API_URL', 'https://api.brevo.com/v3/contacts');
|
||||
|
||||
if (empty(BREVO_API_KEY)) {
|
||||
error_log('[BREVO] API key not configured');
|
||||
}
|
||||
|
||||
$allowed_origins = getenv('ALLOWED_ORIGINS') ? explode(',', getenv('ALLOWED_ORIGINS')) : ['*'];
|
||||
define('ALLOWED_ORIGINS', $allowed_origins);
|
||||
Loading…
Add table
Add a link
Reference in a new issue