#!/sbin/openrc-run
command="/usr/bin/auth-server"
command_background=true
command_args="-org _BUBBLE_AUTH_ORG_ -team _BUBBLE_AUTH_TEAM_ -gitea-url _BUBBLE_AUTH_GITEA_URL_ 2>&1"
output_log="/data/auth-server.log"

pidfile="/run/${RC_SVCNAME}.pid"

start_pre() {
    ebegin "Waiting for network"

    timeout=30

    while [ $timeout -gt 0 ]; do
        ip route | grep -q default && break
        sleep 1
        timeout=$((timeout-1))
    done

    ip route | grep -q default || return 1

    eend 0
}

depend() {
    need net
}
