#!/bin/sh

# This will generate the initial password for the admin user
# of the web interface.

# In a linked git worktree, reuse the main checkout's (see gen_all_secrets).
mainfile="${DOMJUDGE_MAIN_ETCDIR:-}/initial_admin_password.secret"
if [ -n "${DOMJUDGE_MAIN_ETCDIR:-}" ] && [ -s "$mainfile" ]; then
	cat "$mainfile"
	exit 0
fi

head -c12 /dev/urandom | base64 | head -c16 | tr '/+' '_-'
echo
