# Deployment Configuration

## Environment Variables for Production

When deploying Sharey to production, make sure to set these environment variables:

```bash
# Required B2 Configuration
export B2_APPLICATION_KEY_ID="your_key_id"
export B2_APPLICATION_KEY="your_key"
export B2_BUCKET_NAME="your_bucket_name"

# Flask Configuration
export FLASK_ENV="production"
export FLASK_DEBUG="False"
```

## Docker Deployment

### Dockerfile
```dockerfile
FROM python:3.9-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

EXPOSE 8866

CMD ["python", "app.py"]
```

### Docker Compose
```yaml
version: '3.8'
services:
  sharey:
    build: .
    ports:
      - "8866:8866"
    environment:
      - B2_APPLICATION_KEY_ID=${B2_APPLICATION_KEY_ID}
      - B2_APPLICATION_KEY=${B2_APPLICATION_KEY}
      - B2_BUCKET_NAME=${B2_BUCKET_NAME}
    volumes:
      - .env:/app/.env
```

## Nginx Reverse Proxy

```nginx
server {
    listen 80;
    server_name your-domain.com;

    location / {
        proxy_pass http://127.0.0.1:8866;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        
        # Increase client max body size for file uploads
        client_max_body_size 100M;
    }
}
```

## Production Considerations

1. **File Size Limits**: Configure your web server to handle large file uploads
2. **HTTPS**: Use SSL/TLS certificates for secure file transfers
3. **Rate Limiting**: Implement rate limiting to prevent abuse
4. **Monitoring**: Set up logging and monitoring for the application
5. **Backup**: B2 provides versioning, but consider backup strategies
6. **Security**: Restrict B2 bucket access and use environment variables for secrets
