Merge pull request #13 from southseact-3d/cto-task-ok-so-when-starting-this-app-i-get-these-errors-i-get-these-e01

Clean up entrypoint startup logs and remove GitHub auth handling
This commit is contained in:
Liam Hetherington
2026-02-09 16:28:07 +00:00
committed by GitHub
2 changed files with 40 additions and 73 deletions

View File

@@ -166,8 +166,6 @@ validate_environment() {
"DODO_PAYMENTS_API_KEY"
"ADMIN_USER"
"ADMIN_PASSWORD"
"REPO_URL"
"REPO_BRANCH"
)
# Check critical variables

View File

@@ -76,30 +76,16 @@ log "=== ENVIRONMENT SANITIZATION COMPLETE ==="
REPO_URL="${REPO_URL:-}"
REPO_DIR="/home/web/data"
REPO_BRANCH="${REPO_BRANCH:-main}"
GITHUB_USERNAME="${GITHUB_USERNAME:-}"
GITHUB_PAT="${GITHUB_PAT:-}"
# Helper function to get authenticated repository URL
get_auth_url() {
local url="$1"
if [ -n "$GITHUB_USERNAME" ] && [ -n "$GITHUB_PAT" ]; then
# Extract the repository path from the URL
local repo_path=$(echo "$url" | sed 's|https://github.com/||')
echo "https://${GITHUB_USERNAME}:${GITHUB_PAT}@github.com/${repo_path}"
else
echo "$url"
fi
}
log "Initializing Shopify AI App Builder..."
# Log repository configuration details
log "Repository Configuration:"
log " URL: ${REPO_URL:-'NOT SET'}"
log " Branch: ${REPO_BRANCH:-'NOT SET'}"
log " Directory: ${REPO_DIR}"
log " GitHub Username: ${GITHUB_USERNAME:-'NOT SET'}"
log " GitHub PAT: ${GITHUB_PAT:+SET (hidden)}${GITHUB_PAT:-NOT SET}"
# Log repository configuration details only when cloning is enabled
if [ -n "$REPO_URL" ]; then
log "Repository Configuration:"
log " URL: ${REPO_URL}"
log " Branch: ${REPO_BRANCH}"
log " Directory: ${REPO_DIR}"
fi
# Only clone/pull if REPO_URL is set
if [ -n "$REPO_URL" ]; then
@@ -107,13 +93,6 @@ if [ -n "$REPO_URL" ]; then
log "Repository directory: $REPO_DIR"
log "Default branch: $REPO_BRANCH"
# Check if authentication credentials are available
if [ -n "$GITHUB_USERNAME" ] && [ -n "$GITHUB_PAT" ]; then
log "GitHub authentication credentials found for user: $GITHUB_USERNAME"
else
log "WARNING: No GitHub authentication credentials found. Private repository access may fail."
fi
# Check if git is available
if ! command -v git &> /dev/null; then
log "ERROR: git is not available in the container"
@@ -130,22 +109,14 @@ if [ -n "$REPO_URL" ]; then
fi
log "Repository not found. Cloning $REPO_URL into $REPO_DIR..."
auth_url=$(get_auth_url "$REPO_URL")
git clone "$auth_url" "$REPO_DIR"
git clone "$REPO_URL" "$REPO_DIR"
cd "$REPO_DIR"
log "Successfully cloned repository"
else
# Repository exists, pull latest changes
cd "$REPO_DIR"
log "Repository found at $REPO_DIR. Pulling latest changes from $REPO_BRANCH..."
# Update remote URL to use authentication if credentials are available
if [ -n "$GITHUB_USERNAME" ] && [ -n "$GITHUB_PAT" ]; then
auth_url=$(get_auth_url "$REPO_URL")
log "Updating remote URL with authentication credentials"
git remote set-url origin "$auth_url"
fi
# Check if we're on a detached HEAD or have uncommitted changes
if git diff --quiet && git diff --cached --quiet; then
git fetch origin
@@ -162,8 +133,8 @@ if [ -n "$REPO_URL" ]; then
fi
log "Repository is ready at $REPO_DIR"
else
log "No REPO_URL set - starting with empty workspace"
mkdir -p "$REPO_DIR"
log "Workspace directory ready at $REPO_DIR"
fi
log "Starting Shopify AI App Builder service..."
@@ -229,43 +200,41 @@ ensure_root_opencode_config() {
log "Writing OpenCode config: ${config_path} (baseURL=${OPENCODE_OLLAMA_BASE_URL}, model=${OPENCODE_OLLAMA_MODEL})"
python3 - <<'PY' > "$config_path"
import json, os
node - <<'NODE' > "$config_path"
const baseUrl = (process.env.OPENCODE_OLLAMA_BASE_URL || "https://ollama.plugincompass.com").replace(/\/+$/, "");
const modelId = process.env.OPENCODE_OLLAMA_MODEL || "qwen3:0.6b";
const apiKey = (process.env.OPENCODE_OLLAMA_API_KEY || "").trim();
const providerName = process.env.OPENCODE_OLLAMA_PROVIDER || "ollama";
base_url = (os.environ.get("OPENCODE_OLLAMA_BASE_URL") or "https://ollama.plugincompass.com").rstrip("/")
model_id = os.environ.get("OPENCODE_OLLAMA_MODEL") or "qwen3:0.6b"
api_key = (os.environ.get("OPENCODE_OLLAMA_API_KEY") or "").strip()
provider_name = os.environ.get("OPENCODE_OLLAMA_PROVIDER") or "ollama"
provider_cfg = {
"options": {
"baseURL": base_url,
},
"models": {
model_id: {
"id": model_id,
"name": model_id,
"tool_call": True,
"temperature": True,
}
const providerConfig = {
options: {
baseURL: baseUrl,
},
models: {
[modelId]: {
id: modelId,
name: modelId,
tool_call: true,
temperature: true,
},
},
};
if (apiKey) {
providerConfig.options.apiKey = apiKey;
}
if api_key:
provider_cfg["options"]["apiKey"] = api_key
const config = {
$schema: "https://opencode.ai/config.json",
model: `${providerName}/${modelId}`,
small_model: `${providerName}/${modelId}`,
provider: {
[providerName]: providerConfig,
},
};
cfg = {
"$schema": "https://opencode.ai/config.json",
"model": f"{provider_name}/{model_id}",
"small_model": f"{provider_name}/{model_id}",
"provider": {
provider_name: provider_cfg,
},
}
print(json.dumps(cfg, indent=2))
PY
process.stdout.write(`${JSON.stringify(config, null, 2)}\n`);
NODE
chmod 600 "$config_path" 2>/dev/null || true
}