#!/usr/bin/env bash

# VS Code WSL server startup hook.
# Loads private environment variables from ~/.env.secrets if available.

secrets_file="$HOME/.env.secrets"

warn() {
    printf 'server-env-setup: %s\n' "$1" >&2
}

if [ ! -f "$secrets_file" ]; then
    warn "warning: $secrets_file not found; starting without extra secrets."
    return 0 2>/dev/null || exit 0
fi

# shellcheck disable=SC1090
if ! source "$secrets_file"; then
    warn "warning: failed to source $secrets_file; starting without extra secrets."
fi

return 0 2>/dev/null || exit 0
