#!/bin/sh

# Script to generate REST API credentials. These will be written to stdout,
# you can redirect stdout to etc/restapi.secret

# Exit on any error:
set -e

echo "# Randomly generated on host `hostname`, `date`"
echo "# Format: '<ID> <API url> <user> <password>'"

printf "default\\thttp://localhost/domjudge/api\\tjudgehost\\t"
        head -c24 /dev/urandom | base64 | head -c32 | tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~'
echo
