habppyar commited on
Commit
2cfbcd2
·
verified ·
1 Parent(s): a261a58

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +7 -4
start.sh CHANGED
@@ -6,7 +6,6 @@ log() { echo "[start] $*"; }
6
  APP_PORT="${APP_PORT:-7860}"
7
  BOOTSTRAP_DIR="/app/bootstrap"
8
 
9
- # Map your existing Space secret to what OpenCode uses
10
  # OpenCode web basic-auth uses OPENCODE_SERVER_PASSWORD
11
  if [[ -n "${OPENCODE_PASSWORD:-}" ]]; then
12
  export OPENCODE_SERVER_PASSWORD="${OPENCODE_PASSWORD}"
@@ -22,6 +21,7 @@ fi
22
  CONFIG_FILE="${PERSIST_ROOT}/opencode.jsonc"
23
  CONFIG_DIR="${PERSIST_ROOT}/opencode.d"
24
 
 
25
  export OPENCODE_CONFIG="${CONFIG_FILE}"
26
  export OPENCODE_CONFIG_DIR="${CONFIG_DIR}"
27
 
@@ -39,7 +39,10 @@ if [[ ! -d "/data" || ! -w "/data" ]]; then
39
  fi
40
  mkdir -p "${WORKSPACE_ROOT}/chat" "${WORKSPACE_ROOT}/test" "${WORKSPACE_ROOT}/project"
41
 
42
- # “最短路径”策略:每次启动用仓库 bootstrap 覆盖写到 /data
 
 
 
43
  log "Sync bootstrap => ${PERSIST_ROOT}"
44
  cp -f "${BOOTSTRAP_DIR}/opencode.jsonc" "${CONFIG_FILE}"
45
  rm -rf "${CONFIG_DIR}"
@@ -55,6 +58,6 @@ opencode --version || true
55
  log "Workspace root: ${WORKSPACE_ROOT}"
56
  log "Starting OpenCode Web on 0.0.0.0:${APP_PORT}"
57
 
58
- # Make /data/workspace the default working directory for the web UI
59
  cd "${WORKSPACE_ROOT}"
60
- exec opencode --cwd "${WORKSPACE_ROOT}" web --hostname 0.0.0.0 --port "${APP_PORT}"
 
6
  APP_PORT="${APP_PORT:-7860}"
7
  BOOTSTRAP_DIR="/app/bootstrap"
8
 
 
9
  # OpenCode web basic-auth uses OPENCODE_SERVER_PASSWORD
10
  if [[ -n "${OPENCODE_PASSWORD:-}" ]]; then
11
  export OPENCODE_SERVER_PASSWORD="${OPENCODE_PASSWORD}"
 
21
  CONFIG_FILE="${PERSIST_ROOT}/opencode.jsonc"
22
  CONFIG_DIR="${PERSIST_ROOT}/opencode.d"
23
 
24
+ # Tell OpenCode where to load config + skills/plugins/etc from
25
  export OPENCODE_CONFIG="${CONFIG_FILE}"
26
  export OPENCODE_CONFIG_DIR="${CONFIG_DIR}"
27
 
 
39
  fi
40
  mkdir -p "${WORKSPACE_ROOT}/chat" "${WORKSPACE_ROOT}/test" "${WORKSPACE_ROOT}/project"
41
 
42
+ # Make it easy to find from "/" in the web file picker
43
+ ln -sfn "${WORKSPACE_ROOT}" /workspace || true
44
+
45
+ # Seed/overwrite persisted config from repo bootstrap (simple + reproducible)
46
  log "Sync bootstrap => ${PERSIST_ROOT}"
47
  cp -f "${BOOTSTRAP_DIR}/opencode.jsonc" "${CONFIG_FILE}"
48
  rm -rf "${CONFIG_DIR}"
 
58
  log "Workspace root: ${WORKSPACE_ROOT}"
59
  log "Starting OpenCode Web on 0.0.0.0:${APP_PORT}"
60
 
61
+ # IMPORTANT: do NOT use "--cwd" (this opencode doesn't support it)
62
  cd "${WORKSPACE_ROOT}"
63
+ exec opencode web --hostname 0.0.0.0 --port "${APP_PORT}"