Skip to content

Multi-Environment Setup

Set up separate pipelines for different environments.

Create separate pipelines for each environment:

  • Development - On push to develop
  • Staging - On push to main
  • Production - Manual trigger with approval

Configure flavors in your Flutter app:

pubspec.yaml
flutter:
flavors:
development:
app-name: "My App Dev"
staging:
app-name: "My App Staging"
production:
app-name: "My App"

Build with flavor:

Terminal window
flutter build apk --flavor production

Use different variables per pipeline:

  • API_URL - Different per environment
  • ANALYTICS_KEY - Different per environment

For local API development, you can run agents that connect to both local and production APIs with automatic failover.

Use profiles to maintain separate CLI configurations:

Terminal window
# Login to production
flightstack login
# Login to local development API
flightstack login --profile dev --api-url http://localhost:5000

This creates:

  • ~/.flightstack/cli_config.json - Production credentials
  • ~/.flightstack/cli_config.dev.json - Local development credentials

Register separate agents for each environment:

Terminal window
# Register agent for production
flightstack-agent register
# Register agent for local development
flightstack-agent register --profile dev --api-url http://localhost:5000

For seamless development, run the agent with multiple API URLs. The agent automatically:

  • Connects to the first available API (local takes priority)
  • Falls back to production if local is unavailable
  • Reconnects to local when it becomes available again
Terminal window
flightstack-agent start \
--api-url http://localhost:5000 \
--api-url https://api.flightstack.voostack.com \
--reconnect-interval 30

Set a default profile using environment variables:

Terminal window
# Add to your ~/.zshrc or ~/.bashrc
export FLIGHTSTACK_PROFILE=dev
# Now all commands use the dev profile by default
flightstack status # Uses dev profile
flightstack-agent start # Uses dev profile

The agent automatically loads authentication from your CLI config. If you’re logged in via flightstack login, the agent registration will use the same credentials.