feat(dev): ensure-env generates all self-owned secrets (PMS-490) #390
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/PMS-490-ensure-env-generates-secrets"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
ensure-env previously did
test -f .env || cp .env.example .env, copying the generic dev secrets verbatim into .env (MOKOSH_PG_PASSWORD=postgres, MOKOSH_APP_PASSWORD=mokosh_app_dev, JWT_SECRET=change-this..., etc.). Now the create path generates a strong random value for every self-owned secret so no generic password ever survives into .env.Generated keys and formats: MOKOSH_PG_PASSWORD / MOKOSH_MIGRATOR_PASSWORD / MOKOSH_APP_PASSWORD / INFISICAL_PG_PASSWORD are hex (URL-safe alphanumeric, 48 chars) so they interpolate raw into postgres:// URLs; ENCRYPTION_KEY and JWT_SECRET are 64 hex chars (32 bytes / 256-bit); INFISICAL_ENCRYPTION_KEY is 32 hex chars (16 bytes); INFISICAL_AUTH_SECRET is base64 of 32 random bytes. The host-side URL lines (DATABASE_URL, MOKOSH_ADMIN_DATABASE_URL, MOKOSH_APP_DATABASE_URL, INFISICAL_DB_CONNECTION_URI) are rebuilt from the same generated passwords so sqlx-cli stays consistent with the container roles compose provisions from the knobs.
Only the create path generates; an existing .env is left untouched, so the recipe stays idempotent as a dependency of dev/dev-infisical/pre-commit. Third-party credentials (Google, Stripe, Twilio, Slack, Infisical client, SMTP) cannot be generated and remain empty placeholders.
.env.example no longer ships generic values for the self-owned keys: their values are emptied and the embedded URL passwords blanked, with comments pointing at ensure-env as the generator.
#PMS-490