Set an environment variable for your deployed agent
Sets environment variables in .atxp/.env.production for deployment to cloud.atxp.ai.
/plugin marketplace add atxp-dev/claude/plugin install cloud@atxpSets an environment variable by writing it to .atxp/.env.production, which is included in deployments to cloud.atxp.ai.
/configure-env-var KEY VALUE
Replace KEY with your environment variable name and VALUE with its value.
Set API keys for external services:
/configure-env-var GOOGLE_ANALYTICS_API_KEY ya29.a0AfH6SMBx...
/configure-env-var GOOGLE_SEARCH_CONSOLE_KEY AIzaSyC...
/configure-env-var DATAFORSEO_API_KEY 12345678-1234-1234-1234-123456789abc
.atxp/.env.production if it doesn't existKEY=VALUE format600 (owner read/write only)/deploy/remove-env-var to delete variables."Hello World")=, :, /, etc.#!/bin/bash
# Parse arguments
if [ "$#" -lt 2 ]; then
echo "Usage: /configure-env-var KEY VALUE"
echo "Example: /configure-env-var API_KEY abc123"
exit 1
fi
KEY="$1"
shift
VALUE="$*"
# Validate key format (alphanumeric and underscore only)
if ! echo "$KEY" | grep -qE '^[A-Za-z_][A-Za-z0-9_]*$'; then
echo "Error: KEY must start with a letter or underscore and contain only alphanumeric characters and underscores"
exit 1
fi
# Create .atxp directory if it doesn't exist
mkdir -p .atxp
ENV_FILE=".atxp/.env.production"
# Create or update the env file
if [ -f "$ENV_FILE" ]; then
# File exists, check if key already exists
if grep -q "^${KEY}=" "$ENV_FILE"; then
# Update existing key
# Use a temporary file for safety
TEMP_FILE=$(mktemp) || {
echo "Error: Failed to create temporary file"
exit 1
}
while IFS= read -r line; do
if [[ "$line" =~ ^${KEY}= ]]; then
echo "${KEY}=${VALUE}"
else
echo "$line"
fi
done < "$ENV_FILE" > "$TEMP_FILE"
mv "$TEMP_FILE" "$ENV_FILE"
echo "✓ Updated ${KEY} in ${ENV_FILE}"
else
# Append new key
echo "${KEY}=${VALUE}" >> "$ENV_FILE"
echo "✓ Added ${KEY} to ${ENV_FILE}"
fi
else
# Create new file
echo "${KEY}=${VALUE}" > "$ENV_FILE"
chmod 600 "$ENV_FILE"
echo "✓ Created ${ENV_FILE} with ${KEY}"
fi
# Ensure restrictive permissions on existing file
chmod 600 "$ENV_FILE" 2>/dev/null || true
# Check if .gitignore exists and contains the env file
GITIGNORE_WARNED=false
if [ -f ".gitignore" ]; then
if ! grep -qF ".atxp/.env.production" .gitignore; then
GITIGNORE_WARNED=true
fi
else
GITIGNORE_WARNED=true
fi
if [ "$GITIGNORE_WARNED" = true ]; then
echo ""
echo "⚠️ SECURITY WARNING: Add .atxp/.env.production to your .gitignore"
echo " Run: echo '.atxp/.env.production' >> .gitignore"
fi
echo ""
echo "Next steps:"
echo " 1. Review variables: /list-env-vars"
echo " 2. Deploy your agent: /deploy"
⚠️ Important Security Notes:
Git Protection: The .atxp/.env.production file contains sensitive credentials and should never be committed to version control. Add it to your .gitignore:
echo '.atxp/.env.production' >> .gitignore
The command will warn you if this entry is missing.
Shell History: When using this command, secrets are stored in your shell history. For highly sensitive values, consider:
.atxp/.env.production insteadhistory -d $(history 1)/configure-env-var API_KEY "$SECRET_FROM_ENV"File Permissions: The file is automatically created with 600 permissions (owner read/write only) to prevent other system users from accessing secrets.
Variables are stored in standard .env format:
KEY1=value1
KEY2=value2
KEY3=value with spaces
/list-env-vars/remove-env-var KEY.atxp/.env.production if needed/deploy/list-env-vars - List all configured environment variables/remove-env-var - Remove an environment variable/deploy - Deploy your agent with environment variables