Skip to content

Commit fab2091

Browse files
committed
fix(runtime): ensure auth config and bump opencode submodule
1 parent 4a65137 commit fab2091

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

packages/core/src/docker/files/entrypoint.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,34 @@ else
160160
# Ensure user records directory exists (ephemeral unless mounted)
161161
install -d -m 0700 /var/lib/opencode-users
162162

163+
ensure_auth_config() {
164+
local config_dir="/home/opencoder/.config/opencode"
165+
local config_json="${config_dir}/opencode.json"
166+
local config_jsonc="${config_dir}/opencode.jsonc"
167+
168+
install -d -m 0755 "${config_dir}"
169+
170+
if [ -f "${config_json}" ] || [ -f "${config_jsonc}" ]; then
171+
return
172+
fi
173+
174+
if ! cat > "${config_jsonc}" <<'EOF'
175+
{
176+
"auth": {
177+
"enabled": true
178+
}
179+
}
180+
EOF
181+
then
182+
log "WARNING: Failed to create ${config_jsonc}; auth may be disabled."
183+
return
184+
fi
185+
186+
chown opencoder:opencoder "${config_jsonc}" 2>/dev/null || true
187+
chmod 644 "${config_jsonc}" 2>/dev/null || true
188+
log "Created default auth config at ${config_jsonc}."
189+
}
190+
163191
restore_users() {
164192
shopt -s nullglob
165193
local records=(/var/lib/opencode-users/*.json)
@@ -353,6 +381,7 @@ else
353381
maybe_initialize_bootstrap_mode
354382
}
355383

384+
ensure_auth_config
356385
restore_or_bootstrap_users
357386
sync_bootstrap_state
358387

packages/opencode

0 commit comments

Comments
 (0)