-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-entrypoint.sh
executable file
·48 lines (40 loc) · 1.18 KB
/
docker-entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
set -eu
maincfg=/data/configs/znc.conf
[[ -f $maincfg ]] || {
echo "WARNING: No configuration file found, will generate the default config now..." >&2
password_salt="$(tr -dc 'A-Za-z0-9!?.,:;/*-+_()' </dev/urandom | head -c 20)"
password=${PASS:-}
[[ -n $password ]] || {
password="$(tr -dc 'A-Za-z0-9!?.,:;/*-+_()' </dev/urandom | head -c 32)"
echo "WARNING: Empty password detected, auto-generated password is used for ${USER:-admin}: ${password}" >&2
}
mkdir -p "$(dirname "${maincfg}")"
korvike -o "${maincfg}" <<EOF
HideVersion = true
LoadModule = webadmin
Skin = dark-clouds
Version = 1.8.2
<Listener l>
Port = {{ env "LISTEN_PORT" "16667" }}
IPv4 = {{ env "USE_IPV4" "true" }}
IPv6 = {{ env "USE_IPV6" "true" }}
SSL = false
</Listener>
<User {{ env "USER" "admin" }}>
Admin = true
Nick = {{ env "USER" "admin" }}
AltNick = {{ env "USER" "admin" }}_
Ident = {{ env "USER" "admin" }}
LoadModule = chansaver
LoadModule = controlpanel
<Pass password>
Hash = {{ hash "sha256" "${password}${password_salt}" }}
Method = SHA256
Salt = ${password_salt}
</Pass>
</User>
EOF
}
chown -R znc:znc /data
exec gosu znc znc -d /data -f