#!/bin/bash

source /opt/scripts_local/shared_functions.sh

sudo apt-get install cockpit -y
sudo systemctl enable --now cockpit.socket
if ! (sudo grep cockpit- /etc/caddy/Caddyfile >/dev/null 2>&1); then
sudo bash -c "cat >> '/etc/caddy/Caddyfile'" << EOF
cockpit-$HOSTNAME.noxs.me:80 {
  reverse_proxy localhost:9090
}
EOF
sudo systemctl reload caddy
fi