Files

13 lines
378 B
Bash

#!/bin/sh
set -eu
# Prints a cryptographically random SECRET_KEY value; does not modify .env.
if command -v python3 >/dev/null 2>&1; then
python3 -c 'import secrets; print(secrets.token_hex(32))'
elif command -v openssl >/dev/null 2>&1; then
openssl rand -hex 32
else
printf '%s\n' "Neither python3 nor openssl is available to generate a secret." >&2
exit 1
fi