Changing the Gemini key or SMTP used to mean a redeploy. Absurd for a single-tenant portfolio I maintain myself. I switched to the Carnet de bord / news CMS pattern: options in admin, secrets encrypted at rest, merge at boot.
Clear boundary
In .env |
In admin (AppConfig) |
|---|---|
APP_KEY, DB_* |
SMTP, from, contact notify |
OWNER_EMAIL (login lock) |
Gemini / AI models |
| Rate limits, captcha, maintenance 503 |
The “empty keep existing” rule
if (blank($request->input('smtp_password'))) {
unset($payload['smtp_password']); // do not overwrite
}
Without it, an honest admin save wipes the secret. I did it once. Once too many.
RuntimeConfigApplier
At boot, DB values are pushed into config('mail'), etc. Feature tests seed AppConfig — not only .env.testing. Otherwise tests pass locally and production lies.