PortValhalla/scripts/Common/Software/docker/services/teamspeak/main.fish

48 lines
1.4 KiB
Fish

#!/bin/env fish
begin
set -l dir (status dirname)
set -l source "$dir/docker-compose.secrets.yml"
source "$dir/../service.fish"
function installSW -V dir -V domain -V source
set -l service "teamspeak"
set -l pw (nix-shell -p keepassxc --run "keepassxc-cli generate --length 32")
set -l db "TeamSpeak"
set -l tsEnv "$(getServiceKey "$service").environment"
set -l dbEnv "$(getServiceKey db).environment"
initializeServiceInstallation $argv
cp "$dir/docker-compose.base.yml" (getServiceRoot $argv)
USER="$service" begin
yq "$tsEnv.TS3SERVER_DB_USER = env(USER)" "$source" | \
yq "$dbEnv.MARIADB_USER = env(USER)"
end | \
PW="$pw" begin
yq "$tsEnv.TS3SERVER_DB_PASSWORD = env(PW)" | \
yq "$dbEnv.MARIADB_PASSWORD = env(PW)"
end | \
DB="$db" begin
yq "$tsEnv.TS3SERVER_DB_NAME = env(DB)" | \
yq "$dbEnv.MARIADB_DATABASE = env(DB)"
end | \
sudo tee (getServiceSecretsConfig $argv) >/dev/null
installDockerService $argv
end
function configureSW -V dir
configureDockerService $argv
end
function getServiceServers -V server
end
function getServiceLocations
end
function getBackupArgs
printf "%s\n" --hidden --no-ignore . --exclude "docker-compose.yml" (getServiceRoot $argv)
end
runInstaller --force $argv
end