1
0
mirror of https://github.com/juanfont/headscale.git synced 2024-12-20 19:09:07 +01:00
juanfont.headscale/docker/headscale.sh
2020-07-27 22:07:23 +10:00

28 lines
616 B
Bash
Executable File

#!/bin/bash
cd /build/headscale
echo 'Writing config...'
echo '''
{
"server_url": "$SERVER_URL",
"listen_addr": "0.0.0.0:8000",
"private_key_path": "private.key",
"public_key_path": "public.key",
"db_host": "localhost",
"db_port": 5432,
"db_name": "headscale",
"db_user": "admin",
"db_pass": "$POSTGRES_PASSWORD"
}
''' > config.json
# Wait until PostgreSQL started and listens on port 5432.
while [ -z "`netstat -tln | grep 5432`" ]; do
echo 'Waiting for PostgreSQL to start ...'
sleep 1
done
echo 'PostgreSQL started.'
# Start server.
echo 'Starting server...'
./headscale