Skip to main content

Update Environment Variables

Step 1: Update Environment Variables

After all domains have been configured, update each service’s .env file to reflect the new hostnames and any other required settings.

  1. Connect to the EC2 instance (if you are not already connected).

  2. Run the environment‑setup script:

    cd /home
    ./env_setup.sh
  3. Choose the service to edit when prompted:

    Which service .env do you want to update?
    1) Backend
    2) Auth
    3) App
    4) Exit
  4. Select your preferred editor (nano or vi), make the necessary changes (e.g., update DOMAIN, API_URL, or any secrets), then save and exit.

  5. The script automatically:

    • Detects whether the file actually changed.

    • Restarts only the affected service (sparrow-api, sparrow-auth, or sparrow-app) if a change was detected, printing a confirmation message such as:

      Restarting sparrow-api service...
      [INFO] sparrow-api service restarted.

Tip:

• If you open the file but make no changes, the script will skip the restart.

• You can rerun env_setup.sh at any time to modify additional services or update existing values.

Reference Environment Files

To help you edit your .env files correctly, we’ve provided example snippets for each Sparrow service. These serve as a template for which keys you should update.

Use these to:

Understand what keys are required.

Replace placeholder values (e.g., localhost) with your actual domains.

Ensure your configuration is consistent across all services.