Initial commit — Donna portal v1
Setup completo del portal interno donna.aal-law.com: * Landing público con OAuth login + grid de apps autenticado * Flujo OAuth2 contra Mailcow (mail.aal-law.com) * Sesiones SSO compartidas en el dominio (cookie donna_session, 8h) * Whitelist de dominios aal-law.com / aalnlaw.com * App "Control de Escrituras" migrada desde ZH-Consultores/control-escrituras (mismo schema, mismo frontend, ahora con shared Auth/Db/Config libs) * Migraciones SQL para users, escrituras_tramites, escrituras_historial * Caddy on :80 con rewrite extless → .php * Backup diario MariaDB (systemd timer + script) con retención 14d * Documentación de arquitectura en README + infra files en docs/infra
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
final class Config {
|
||||
private static ?array $env = null;
|
||||
|
||||
public static function load(string $path = '/etc/donna/donna.env'): void {
|
||||
if (self::$env !== null) return;
|
||||
if (!is_readable($path)) {
|
||||
http_response_code(500);
|
||||
exit('Config no disponible.');
|
||||
}
|
||||
$vars = parse_ini_file($path, false, INI_SCANNER_RAW);
|
||||
if ($vars === false) {
|
||||
http_response_code(500);
|
||||
exit('Config inválida.');
|
||||
}
|
||||
self::$env = $vars;
|
||||
}
|
||||
|
||||
public static function get(string $key, ?string $default = null): string {
|
||||
self::load();
|
||||
return self::$env[$key] ?? $default ?? '';
|
||||
}
|
||||
|
||||
public static function int(string $key, int $default = 0): int {
|
||||
return (int) self::get($key, (string) $default);
|
||||
}
|
||||
|
||||
public static function list(string $key): array {
|
||||
$v = self::get($key);
|
||||
return $v === '' ? [] : array_map('trim', explode(',', $v));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user