#!/bin/sh
# Copyright (c) 2026 Athan Clark. SPDX-License-Identifier: GPL-3.0-only
# Sets the administrator's password back to ADMIN_INITIAL_PASSWORD from the configuration
# (#118): the ADMIN_USERNAME account. Its sessions are signed out. Edit ADMIN_INITIAL_PASSWORD
# first to choose a new password. Usage: openchronology-reset-admin-password
set -eu
CONFIG=@HOMEBREW_PREFIX@/etc/openchronology/openchronology.env
if [ ! -r "$CONFIG" ]; then
  echo "$CONFIG is missing: run openchronology-setup." >&2
  exit 1
fi
OCH_CONFIG="$CONFIG" exec "@NODE@" "@LIBEXEC@/server/reset-admin-password.mjs"
