Files
setup/bin/create_key.sh

12 lines
263 B
Bash
Executable File

#!/bin/bash
# This generates an environmental variable safe key for use in various applications.
KEY_LENGTH=$1
if [[ -z "$KEY_LENGTH" ]]; then
KEY_LENGTH=32
fi
KEY=$(head -c $KEY_LENGTH /dev/urandom | base64 | tr -d '=+/ ' | cut -c1-$KEY_LENGTH)
echo $KEY