claude-docker/scripts/startup.sh
Vishal Jain 9d1f8d0661 Add git user configuration support
Add required git user configuration to enable commits from within the container.
This change ensures proper attribution of git commits made inside the container by:

- Adding GIT_USER_NAME and GIT_USER_EMAIL to .env.example
- Configuring git user globally during Docker build
- Adding documentation for git configuration requirements
- Updating README with clearer setup instructions and requirements

The configuration is now required as part of the initial setup to prevent
issues with unattributed commits when using git inside the container.
2025-06-18 13:54:58 +01:00

46 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# ABOUTME: Startup script for Claude Code container with MCP server
# ABOUTME: Loads environment and starts Claude Code with pre-configured Twilio MCP
# Load environment variables from .env if it exists
# Use the .env file baked into the image at build time
if [ -f /app/.env ]; then
echo "Loading environment from baked-in .env file"
set -a
source /app/.env 2>/dev/null || true
set +a
# Export Twilio variables for runtime use
export TWILIO_ACCOUNT_SID
export TWILIO_AUTH_TOKEN
export TWILIO_FROM_NUMBER
export TWILIO_TO_NUMBER
else
echo "WARNING: No .env file found in image."
fi
# Check for existing authentication
if [ -f "$HOME/.claude/.credentials.json" ]; then
echo "Found existing Claude authentication"
else
echo "No existing authentication found - you will need to log in"
echo "Your login will be saved for future sessions"
fi
# Verify Twilio MCP configuration
if [ -n "$TWILIO_ACCOUNT_SID" ] && [ -n "$TWILIO_AUTH_TOKEN" ]; then
echo "✓ Twilio MCP server configured - SMS notifications enabled"
else
echo "No Twilio credentials found - SMS notifications disabled"
fi
# Configure git for the mounted workspace
if [ -n "$GIT_USER_NAME" ] && [ -n "$GIT_USER_EMAIL" ]; then
echo "✓ Configuring git: $GIT_USER_NAME <$GIT_USER_EMAIL>"
git config --global user.name "$GIT_USER_NAME"
git config --global user.email "$GIT_USER_EMAIL"
fi
# Start Claude Code with permissions bypass
echo "Starting Claude Code..."
exec claude --dangerously-skip-permissions "$@"