mirror of
https://github.com/tiennm99/coolify.git
synced 2026-08-20 22:23:39 +00:00
Allow s6 services to start for specific roles like horizon, scheduler, nightwatch, and flux while keeping all as the default.
27 lines
580 B
Bash
Executable File
27 lines
580 B
Bash
Executable File
#!/bin/sh
|
|
|
|
coolify_container_role_value() {
|
|
role="${COOLIFY_CONTAINER_ROLE:-}"
|
|
|
|
if [ -z "$role" ]; then
|
|
role="$(grep -E '^COOLIFY_CONTAINER_ROLE=' .env 2>/dev/null | tail -n1 | cut -d= -f2- | tr -d '"' | tr -d "'")"
|
|
fi
|
|
|
|
printf '%s\n' "${role:-all}"
|
|
}
|
|
|
|
coolify_container_has_role() {
|
|
wanted_role="$1"
|
|
roles="$(coolify_container_role_value | tr '[:upper:]' '[:lower:]' | tr ',' ' ')"
|
|
|
|
for role in $roles; do
|
|
case "$role" in
|
|
all|"$wanted_role")
|
|
return 0
|
|
;;
|
|
esac
|
|
done
|
|
|
|
return 1
|
|
}
|