Enhance setup script with robust credentials, environment, and dynamic database configuration #23
+216
−10
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.
The setup script has been enhanced to handle common configuration issues that developers encounter when setting up the application, particularly around Rails credentials, environment variables, and database naming customization.
Key Improvements
1. Robust Credentials Management
The setup script now intelligently handles the scenario where
config/credentials.yml.enc
exists butconfig/master.key
is missing. When this situation is detected, users are presented with three clear options:2. Dynamic Database Configuration
The setup script now prompts users for a custom project name and automatically updates the database configuration to use that name as the prefix instead of the hardcoded "rapid_rails_inertia_js". This allows developers to customize their database names during setup:
== Database Configuration == Current database prefix: rapid_rails_inertia_js Enter your project name (or press Enter to keep 'rapid_rails_inertia_js'): my_awesome_app Updating database configuration with project name: my_awesome_app ✓ Database configuration updated with prefix: my_awesome_app
Features include:
3. Automatic Environment File Setup
The script automatically creates a
.env
file from.env.example
if it doesn't already exist, ensuring developers have the necessary environment configuration template.4. Enhanced User Guidance
Added comprehensive messaging throughout the setup process with clear status indicators (✓, ⚠, ℹ) for better visual feedback, step-by-step instructions, and references to example files.
5. Improved Documentation
Updated the README with detailed quick start guide, manual setup instructions as fallback, credentials troubleshooting section, and clear environment variable documentation.
Testing
All existing tests pass (32 examples, 0 failures), RuboCop style checks pass, Brakeman security scan shows no warnings, and frontend linting passes. The database name replacement logic has been thoroughly tested.
The enhanced setup script maintains full backward compatibility while providing a much more robust and user-friendly experience for new developers setting up the application.
Fixes #22.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.