coreos-home-server/service/gotosocial/container/run-gotosocial

27 lines
1.3 KiB
Plaintext
Raw Normal View History

#!/bin/sh
set -eu
# Create configuration file from collected templates.
envsubst < /etc/gotosocial/config.yaml.template > /etc/gotosocial/config.yaml
# Create data directories and correct permissions for data files.
2023-08-13 13:13:07 +00:00
chown -R gotosocial:gotosocial /var/lib/gotosocial
# Initialize default condiguration if needed.
if ! test -f /var/lib/gotosocial/gotosocial.db; then
(
password="$(dd if=/dev/urandom | tr -dc '[:alnum:]' | head -c 50)"
gosu gotosocial /usr/bin/gotosocial --config-path /etc/gotosocial/config.yaml admin account create \
--username "$GOTOSOCIAL_DEFAULT_USERNAME" --password "$password" \
--email "${GOTOSOCIAL_DEFAULT_USERNAME}@${GOTOSOCIAL_ACCOUNT_DOMAIN}"
gosu gotosocial /usr/bin/gotosocial --config-path /etc/gotosocial/config.yaml admin account promote \
--username "$GOTOSOCIAL_DEFAULT_USERNAME"
echo "Created an administrator user with username '$GOTOSOCIAL_DEFAULT_USERNAME' and password '$password'."
echo "Make sure to change this immediately after logging in for the first time!"
)
fi
# Run entrypoint under specific user.
exec gosu gotosocial /usr/bin/gotosocial --config-path /etc/gotosocial/config.yaml server start "$@"