Skip to content

Commit

Permalink
put ssh config into encrypted env var
Browse files Browse the repository at this point in the history
  • Loading branch information
luckydye committed Jan 2, 2025
1 parent 5a6ce11 commit 1a7a46e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
21 changes: 17 additions & 4 deletions install
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,28 @@ function explain() {
echo ""
}

git clone https://github.com/luckydye/configs.git ${CONFIGS_DIR} || exit 1
function install_zshrc() {
echo "# luckydye configs" >> ~/.zshrc || exit 1
echo "source $CONFIGS_DIR/.zshrc" >> ~/.zshrc || exit 1
}

function install_ssh_config() {
echo "# luckydye configs" >> ~/.ssh/config || exit 1
echo "Include ~/.ssh/config_configs" >> ~/.ssh/config || exit 1
}


git clone https://github.com/luckydye/configs.git ${CONFIGS_DIR}

# install task
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b $HOME/bin || exit 1

echo "# luckydye configs" >> ~/.zshrc || exit 1
echo "source $CONFIGS_DIR/.zshrc" >> ~/.zshrc || exit 1
source $CONFIGS_DIR/.zshrc || exit 1

grep -Fxq "# luckydye configs" ~/.zshrc || install_zshrc
grep -Fxq "# luckydye configs" ~/.ssh/config || install_ssh_config


source $CONFIGS_DIR/.zshrc || exit 1
task -t $CONFIGS_DIR/setup.yml || exit 1

explain
5 changes: 3 additions & 2 deletions setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ tasks:
platforms: [darwin, linux]
vars:
VAULT_PW:
sh: 'gum input --password --placeholder="Password" --header="Vault"'
sh: 'mise exec gum -- gum input --password --placeholder="Password" --header="Vault"'
predoncition:
sh: "git -C $CONFIGS_DIR/ diff --exit-code"
cmds:
Expand All @@ -36,7 +36,7 @@ tasks:
VAULT_PW:
sh: 'gum input --password --placeholder="Password" --header="Vault"'
cmds:
- cp $CONFIGS_DIR/env $CONFIGS_DIR/env.swap
- cp $CONFIGS_DIR/env $CONFIGS_DIR/env.swap || true
- echo "[pull] Stashing local changes and pulling"
- git -C $CONFIGS_DIR/ add --all
- git -C $CONFIGS_DIR/ stash
Expand All @@ -47,6 +47,7 @@ tasks:
# merge new env with old env.swap
- git -C $CONFIGS_DIR/ merge-file -p $CONFIGS_DIR/env $CONFIGS_DIR/env $CONFIGS_DIR/env.swap >$CONFIGS_DIR/env
- rm $CONFIGS_DIR/env.swap
- echo $SSH_CONFIG > ~/.ssh/config_configs

dependencies:
cmds:
Expand Down

0 comments on commit 1a7a46e

Please sign in to comment.