Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 14, 2025

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 but config/master.key is missing. When this situation is detected, users are presented with three clear options:

  • Provide existing master.key: Enter the 32-character hex key with format validation
  • Create new credentials file: Safely removes the old encrypted file and generates a fresh one
  • Skip for now: Allows manual setup later with clear instructions

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:

  • Interactive project name prompt during setup
  • Input validation (must start with letter, contain only lowercase letters, numbers, underscores)
  • Automatic replacement of database names across all environments (development, test, production)
  • Backward compatible - keeps default naming if no project name is provided

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.

@Copilot Copilot AI changed the title [WIP] Setup script make more robust Enhance setup script with robust credentials and environment file handling Aug 14, 2025
@Copilot Copilot AI requested a review from danielpaul August 14, 2025 13:46
Copilot finished work on behalf of danielpaul August 14, 2025 13:46
Copy link
Owner

@danielpaul danielpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot ask for the project name and replace the database name in database.yml for the prefix with the project name

Copy link
Contributor Author

Copilot AI commented Aug 14, 2025

@copilot ask for the project name and replace the database name in database.yml for the prefix with the project name

Added dynamic project name configuration to the setup script. The script now prompts users for a project name and automatically replaces the database prefix in config/database.yml with the provided name.

Key features:

  • ✅ Interactive prompt during setup: "Enter your project name (or press Enter to keep 'rapid_rails_inertia_js')"
  • ✅ Input validation (lowercase letters, numbers, underscores only)
  • ✅ Automatic replacement of database names across all environments
  • ✅ Backward compatible (keeps default if no name provided)

Commit: ed49a7e

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@Copilot Copilot AI changed the title Enhance setup script with robust credentials and environment file handling Enhance setup script with robust credentials, environment, and dynamic database configuration Aug 14, 2025
@Copilot Copilot AI requested a review from danielpaul August 14, 2025 20:34
Copilot finished work on behalf of danielpaul August 14, 2025 20:34
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.

Setup script make more robust
2 participants