#!/bin/bash # Setup script to create env files for multi-bot setup set -e echo "Setting up environment files for multi-bot configuration..." echo "" # Create .env.shared if it doesn't exist if [ ! -f .env.shared ]; then cat > .env.shared << 'EOF' # Shared configuration for all nanobot instances # These settings apply to all bots unless overridden in .env.user1, .env.user2, etc. # LLM Provider API Key (shared across all bots) NANOBOT_PROVIDERS__OPENROUTER__API_KEY=sk-or-v1-xxx # Default Model (shared across all bots) NANOBOT_AGENTS__DEFAULTS__MODEL=anthropic/claude-opus-4-5 # Agent Settings (shared) NANOBOT_AGENTS__DEFAULTS__TEMPERATURE=0.7 NANOBOT_AGENTS__DEFAULTS__MAX_TOKENS=8192 NANOBOT_AGENTS__DEFAULTS__MAX_TOOL_ITERATIONS=20 NANOBOT_AGENTS__DEFAULTS__MEMORY_WINDOW=50 # Tool Settings (shared) NANOBOT_TOOLS__RESTRICT_TO_WORKSPACE=true # Gateway Settings (shared) NANOBOT_GATEWAY__PORT=18790 NANOBOT_GATEWAY__HOST=0.0.0.0 EOF echo "✓ Created .env.shared" else echo "⚠ .env.shared already exists, skipping..." fi # Create bot-specific env files for i in 1 2 3; do env_file=".env.user${i}" if [ ! -f "$env_file" ]; then cat > "$env_file" << EOF # Bot-specific configuration for user${i} # These settings override .env.shared for this bot only # Leave empty or comment out to use shared settings # Example: Override model for this bot # NANOBOT_AGENTS__DEFAULTS__MODEL=anthropic/claude-sonnet-4 # Example: Override temperature for this bot # NANOBOT_AGENTS__DEFAULTS__TEMPERATURE=0.9 # Example: Use different API key for this bot # NANOBOT_PROVIDERS__OPENROUTER__API_KEY=sk-or-v1-different-key EOF echo "✓ Created $env_file" else echo "⚠ $env_file already exists, skipping..." fi done echo "" echo "Done! Next steps:" echo "1. Edit .env.shared and add your API keys and shared settings" echo "2. Edit .env.user1, .env.user2, .env.user3 if you need bot-specific overrides" echo "3. Create minimal config.json files in ~/.nanobot-user1, ~/.nanobot-user2, etc." echo "4. Run: docker compose -f docker-compose.multi.env.yml up -d"