create admin user automatically
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Jeffrey Paul 2020-03-22 05:51:17 -07:00
parent fb2bf698ca
commit d5e258ff01
3 changed files with 13 additions and 0 deletions

View File

@ -3,6 +3,8 @@ FROM ubuntu:bionic
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
ENV DEFAULT_ADMIN_PASSWORD hunter2
ARG UBUNTU_MIRROR=http://archive.ubuntu.com/ubuntu ARG UBUNTU_MIRROR=http://archive.ubuntu.com/ubuntu
RUN echo "deb $UBUNTU_MIRROR bionic main universe restricted multiverse" > /etc/apt/sources.list.new && \ RUN echo "deb $UBUNTU_MIRROR bionic main universe restricted multiverse" > /etc/apt/sources.list.new && \

View File

@ -23,6 +23,13 @@ on 20.04 but its build file doesn't work with modern `scons`, sadly.
# Docker Image Information # Docker Image Information
* env:
* `DEFAULT_ADMIN_PASSWORD`: set to the admin password you want for the
`admin` user. default: `hunter2`. Note that passwords are stored
unhashed in plaintext on disk (take it up with the duck, I just
packaged it)
* no-op if `/config/users.txt` already exists, which it will after
first run.
* state/config volume: `/config` * state/config volume: `/config`
* logs to stdout like a good docker * logs to stdout like a good docker

View File

@ -15,5 +15,9 @@ if [[ ! -d /config/certs ]]; then
bash /usr/local/src/adchpp/linux/generate_certs.sh bash /usr/local/src/adchpp/linux/generate_certs.sh
fi fi
if [[ ! -e /config/users.txt ]]; then
echo "[{\"password\":\"$DEFAULT_ADMIN_PASSWORD\",\"nick\":\"admin\",\"level\":10,\"regby\":\"admin\",\"regtime\":1322835912}]" > /config/users.txt
fi
cd /config cd /config
exec /usr/local/bin/adchppd -c /config exec /usr/local/bin/adchppd -c /config