Skip to content

Commit 1cfd871

Browse files
committed
fix: remove fallback config generation from install.sh
The inline heredoc configs duplicated defaults defined in the example YAML files. Treat a failed config template download as a hard error instead of silently generating a potentially stale config.
1 parent 8f26e4c commit 1cfd871

1 file changed

Lines changed: 4 additions & 39 deletions

File tree

scripts/install.sh

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -426,43 +426,15 @@ if [ ! -f "$CONFIG_FILE" ]; then
426426
JWT_SECRET=$(openssl rand -hex 32)
427427

428428
if [ "$OS" = "darwin" ]; then
429-
# macOS config - use template if available, otherwise generate
429+
# macOS config - use template from source or download it
430430
if [ -f "${TMP_DIR}/config.example.darwin.yaml" ]; then
431431
info "Using macOS config template from source..."
432432
cp "${TMP_DIR}/config.example.darwin.yaml" "${TMP_DIR}/config.yaml"
433433
else
434434
info "Downloading macOS config template..."
435435
CONFIG_URL="https://raw.githubusercontent.com/${REPO}/${VERSION}/config.example.darwin.yaml"
436436
if ! curl -fsSL "$CONFIG_URL" -o "${TMP_DIR}/config.yaml"; then
437-
warn "Failed to download config template, generating minimal config..."
438-
cat > "${TMP_DIR}/config.yaml" << YAMLEOF
439-
jwt_secret: "${JWT_SECRET}"
440-
data_dir: "${DATA_DIR}"
441-
port: "8080"
442-
hypervisor:
443-
default: vz
444-
network:
445-
dns_server: 8.8.8.8
446-
logging:
447-
level: debug
448-
caddy:
449-
listen_address: 0.0.0.0
450-
admin_address: 127.0.0.1
451-
admin_port: 2019
452-
internal_dns_port: 5354
453-
stop_on_shutdown: false
454-
registry:
455-
url: 192.168.64.1:8080
456-
insecure: true
457-
build:
458-
builder_image: none
459-
docker_socket: /var/run/docker.sock
460-
max_concurrent_source_builds: 2
461-
timeout: 600
462-
limits:
463-
max_vcpus_per_instance: 4
464-
max_memory_per_instance: 8GB
465-
YAMLEOF
437+
error "Failed to download config template from ${CONFIG_URL}"
466438
fi
467439
fi
468440

@@ -506,22 +478,15 @@ YAMLEOF
506478
info "Installing config file at ${CONFIG_FILE}..."
507479
install -m 600 "${TMP_DIR}/config.yaml" "$CONFIG_FILE"
508480
else
509-
# Linux config - use template if available, otherwise generate
481+
# Linux config - use template from source or download it
510482
if [ -f "${TMP_DIR}/config.example.yaml" ]; then
511483
info "Using config template from source..."
512484
cp "${TMP_DIR}/config.example.yaml" "${TMP_DIR}/config.yaml"
513485
else
514486
info "Downloading config template..."
515487
CONFIG_URL="https://raw.githubusercontent.com/${REPO}/${VERSION}/config.example.yaml"
516488
if ! curl -fsSL "$CONFIG_URL" -o "${TMP_DIR}/config.yaml"; then
517-
warn "Failed to download config template, generating minimal config..."
518-
cat > "${TMP_DIR}/config.yaml" << YAMLEOF
519-
jwt_secret: "${JWT_SECRET}"
520-
data_dir: /var/lib/hypeman
521-
caddy:
522-
admin_port: 2019
523-
internal_dns_port: 5353
524-
YAMLEOF
489+
error "Failed to download config template from ${CONFIG_URL}"
525490
fi
526491
fi
527492

0 commit comments

Comments
 (0)