Adds secret loading

This commit is contained in:
Michel Fedde 2025-09-27 15:15:30 +02:00
parent cbf899eb40
commit 63fcd502a8
5 changed files with 81 additions and 30 deletions

View file

@ -0,0 +1,36 @@
#!/bin/bash
loadSecretsRepo() {
secretsGitPath="ssh://secrets-git-host/neintonine/yadm-config-secrets.git"
secretsFolderPath="$HOME/.local/share/secrets"
configFile="$HOME/.ssh/config"
if [[ -d "$secretsFolderPath/.git" ]]; then
(
cd "$secretsFolderPath"
git pull --ff-only
)
return 0
fi
if [[ ! -f "$configFile" ]]; then
echo "Can't find the ssh config file!"
return 1
fi
if ! grep "Host secrets-git-host" "$configFile" >/dev/null; then
echo "Can't find secrets-git-host config"
return 1
fi
git clone "$secretsGitPath" "$secretsFolderPath"
}
loadSecrets() {
secretsFolderPath="$HOME/.local/share/secrets"
loadSecretsRepo
"$secretsFolderPath/deploy.sh"
}
addActions loadSecrets