fix(langfuse): fix goose langfuse integration (wrong env variables)

This commit is contained in:
2025-03-11 12:12:20 -06:00
parent 167d73a964
commit c56b4b35f5
6 changed files with 178 additions and 32 deletions

View File

@@ -8,6 +8,26 @@ exec > >(tee -a /init.log) 2>&1
echo "=== MC Initialization started at $(date) ==="
echo "INIT_COMPLETE=false" > /init.status
# Set up persistent configuration symlinks
if [ -n "$MC_CONFIG_DIR" ] && [ -d "$MC_CONFIG_DIR" ]; then
echo "Setting up persistent configuration in $MC_CONFIG_DIR"
# Create Goose configuration directory
mkdir -p "$MC_CONFIG_DIR/goose"
# Create symlink for Goose directory
if [ -d "/app" ]; then
# Make sure .goose directory exists in the target
mkdir -p "$MC_CONFIG_DIR/goose"
# Create the symlink
echo "Creating symlink for Goose configuration: /app/.goose -> $MC_CONFIG_DIR/goose"
ln -sf "$MC_CONFIG_DIR/goose" "/app/.goose"
else
echo "Warning: /app directory does not exist yet, symlinks will be created after project initialization"
fi
fi
# Project initialization
if [ -n "$MC_PROJECT_URL" ]; then
echo "Initializing project: $MC_PROJECT_URL"
@@ -36,13 +56,21 @@ if [ -n "$MC_PROJECT_URL" ]; then
if [ -f "/app/.mc/init.sh" ]; then
bash /app/.mc/init.sh
fi
# Set up symlinks after project is cloned (if MC_CONFIG_DIR exists)
if [ -n "$MC_CONFIG_DIR" ] && [ -d "$MC_CONFIG_DIR" ]; then
echo "Setting up persistent configuration symlinks after project clone"
# Create Goose configuration directory
mkdir -p "$MC_CONFIG_DIR/goose"
# Create symlink for Goose directory
echo "Creating symlink for Goose configuration: /app/.goose -> $MC_CONFIG_DIR/goose"
ln -sf "$MC_CONFIG_DIR/goose" "/app/.goose"
fi
fi
# Set up Goose API key if provided
if [ -n "$GOOSE_API_KEY" ]; then
echo "Setting up Goose API key"
export GOOSE_API_KEY="$GOOSE_API_KEY"
fi
# Goose uses self-hosted instance, no API key required
# Set up MCP connection if provided
if [ -n "$MCP_HOST" ]; then
@@ -51,11 +79,11 @@ if [ -n "$MCP_HOST" ]; then
fi
# Set up Langfuse logging if credentials are provided
if [ -n "$LANGFUSE_SECRET_KEY" ] && [ -n "$LANGFUSE_PUBLIC_KEY" ]; then
if [ -n "$LANGFUSE_INIT_PROJECT_SECRET_KEY" ] && [ -n "$LANGFUSE_INIT_PROJECT_PUBLIC_KEY" ]; then
echo "Setting up Langfuse logging"
export LANGFUSE_SECRET_KEY="$LANGFUSE_SECRET_KEY"
export LANGFUSE_PUBLIC_KEY="$LANGFUSE_PUBLIC_KEY"
export LANGFUSE_HOST="${LANGFUSE_HOST:-https://api.langfuse.com}"
export LANGFUSE_INIT_PROJECT_SECRET_KEY="$LANGFUSE_INIT_PROJECT_SECRET_KEY"
export LANGFUSE_INIT_PROJECT_PUBLIC_KEY="$LANGFUSE_INIT_PROJECT_PUBLIC_KEY"
export LANGFUSE_URL="${LANGFUSE_URL:-https://cloud.langfuse.com}"
fi
echo "MC driver initialization complete"