ansible-taler-exchange

Ansible playbook to deploy a production Taler Exchange
Log | Files | Refs | README | LICENSE

setup-secret-fact (335B)


      1 #!/usr/bin/env bash
      2 
      3 if [ $# -lt 1 ]; then
      4   echo "Usage: $0 <fact_file> [prefix]" >&2
      5   exit 1
      6 fi
      7 
      8 set -eu
      9 set -o pipefail
     10 
     11 # head, not dd: dd can return a short read and silently shorten the secret.
     12 SECRET=$(head -c 32 /dev/urandom | gnunet-base32)
     13 
     14 jq \
     15   -n \
     16   --arg s "$SECRET" \
     17   --arg p "${2:-}" \
     18   '"\($p)\($s)"' \
     19   > "$1"