chore: improve first-run setup with init-generated secrets and actionable doctor - #57
Merged
Merged
Conversation
- `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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reopens #28 after #55 was reverted from
mainbecause the Go lint job failed.Known lint failures to fix before review:
cmd/paystable/doctor.go: three ineffectualfailed = trueassignments (ineffassign)cmd/paystable/doctor.go: three uncheckedfmt.Fprintlnreturn 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