summarylogtreecommitdiffstats
path: root/kellnr.install
blob: ec06deee7644cf788222f197e3069e5b8a9a2589 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# vim: set ts=4 sw=4 et:

function genPwd {
    < /dev/urandom tr -dc A-Z-a-z-0-9 | head -c"${1:-$1}";
}

post_install() {
    echo "Generating random initial admin tokens..."

    ADMIN_PWD=$(genPwd 12)
    sed -i "s/admin_pwd =.*/admin_pwd = \"$ADMIN_PWD\"/" /etc/kellnr/default.toml

    ACCESS_TOKEN=$(genPwd 32)
    sed -i "s/admin_token =.*/admin_token = \"$ACCESS_TOKEN\"/" /etc/kellnr/default.toml
}