Skip to content

chore: improve first-run setup with init-generated secrets and actionable doctor - #57

Merged
samithreddychinni merged 7 commits into
mainfrom
restore/issue-28-first-run-setup
Aug 2, 2026
Merged

chore: improve first-run setup with init-generated secrets and actionable doctor#57
samithreddychinni merged 7 commits into
mainfrom
restore/issue-28-first-run-setup

Conversation

@samithreddychinni

Copy link
Copy Markdown
Collaborator

Reopens #28 after #55 was reverted from main because the Go lint job failed.

Known lint failures to fix before review:

  • cmd/paystable/doctor.go: three ineffectual failed = true assignments (ineffassign)
  • cmd/paystable/doctor.go: three unchecked fmt.Fprintln return values (errcheck)

The original functionality and test coverage are unchanged; this draft needs the lint fixes and a fresh CI run before merge.

Closes #28

- `GenerateSecureKey`: Returns 32 random bytes encoded as a 64 character hex string.
- `GenerateAll`: Provides a set of default secret keys required for a fresh installation (Webhook, Merchant Callback, Admin API, and Encryption keys).
- Added `init` command logic and usage instructions
- Included an embedded `.env.template` for consistent environment configuration
- Updated the `doctor` command to identify missing generated secrets and
  suggest running `init`
- Refined required environment variable checks in `doctor` to improve
  onboarding clarity
- Updated installation script to handle downloads and setup more robustly
- Updated onboarding instructions generated during installation
- Grouped environment variable checks into generated secrets and gateway
  credentials.
- Improved error messages and actionable advice for missing configuration.
- Added structured output sections for "Environment", "Database", and
  "Migrations".
- Enhanced database connection error handling with context-aware advice.
- Added logic to report and apply pending migrations automatically.
- Differentiated between fatal configuration errors and non-fatal gateway
  warnings.
- Added `paystable init` command to automatically generate local secrets into a `.env` file, replacing the manual `.env.example` copy process.
- Updated the installer to use `./paystable init` for initial environment setup.
- Enhanced `paystable doctor` with structured sections for Environment, Database, and Migrations, providing clearer instructions for next steps.
- Refactored status line printing in `doctor.go` to use an overridable `io.Writer` for better testability.
- Added `doctor_test.go` to verify database URL parsing and connection error explanations.
- Included tests for various PostgreSQL error scenarios (missing database, authentication failures, connection refused) with platform-specific hints.
- Added `init_test.go` to validate environment file creation and configuration defaults.
The `curl` command for downloading checksums was incorrectly split across multiple lines, causing it to fail. Now I joined the command into a single line to ensure the checksums.txt file is downloaded correctly before verification.
@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
paystable Ready Ready Preview Aug 1, 2026 11:59am

@samithreddychinni
samithreddychinni merged commit c293322 into main Aug 2, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P2] Improve first-run setup in installer and doctor

2 participants