File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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)
353381 maybe_initialize_bootstrap_mode
354382 }
355383
384+ ensure_auth_config
356385 restore_or_bootstrap_users
357386 sync_bootstrap_state
358387
You can’t perform that action at this time.
0 commit comments