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" "DODO_PAYMENTS_API_KEY"
"ADMIN_USER" "ADMIN_USER"
"ADMIN_PASSWORD" "ADMIN_PASSWORD"
"REPO_URL"
"REPO_BRANCH"
) )
# Check critical variables # Check critical variables

View File

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