#!/sbin/openrc-run
# Atlas control plane (atlasd) — OpenRC service for Alpine/apk hosts. The systemd
# equivalent (deb/rpm) is deploy/linux/atlasd.service; keep the two in step.
# Config lives in the same /etc/atlas/atlasd.env the systemd unit reads.

name="atlasd"
description="Atlas control plane"
command="/usr/bin/atlasd"
command_args="serve"
command_background="yes"
pidfile="/run/atlasd.pid"
output_log="/var/log/atlasd.log"
error_log="/var/log/atlasd.log"

depend() {
	need net
	after firewall
}

start_pre() {
	if [ -f /etc/atlas/atlasd.env ]; then
		set -a
		. /etc/atlas/atlasd.env
		set +a
	fi
	# /var/lib/atlas holds the db, master key, and git repos (design §3.2).
	checkpath --directory --mode 0700 /var/lib/atlas
}
