Adds secret loading
This commit is contained in:
parent
cbf899eb40
commit
63fcd502a8
5 changed files with 81 additions and 30 deletions
36
.config/yadm/bootstrap.v2/applications/01-LoadSecrets.sh
Executable file
36
.config/yadm/bootstrap.v2/applications/01-LoadSecrets.sh
Executable 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue