#!/bin/bash secrets_manager() { clear bw logout #################################### ## Step 0: Set to use tsys server #################################### bw config server https://pwvault.turnsys.com #################################### ## Step 1: login to bitwarden #################################### # From: https://bitwarden.com/help/cli/#using-an-api-key ### Set apikey environment varaible source D:/tsys/secrets/bitwarden/data/apikey-bitwarden-reachableceo ### Login to vault using apikey... bw login --apikey $BW_CLIENTID $BW_CLIENTSECRET ### Step 1.1: unlock / save session id export BW_SESSION="$(bw unlock --passwordenv TSYS_BW_PASSWORD_REACHABLECEO --raw)" ### Step 2: retrive a value into an environment variable export USER_TOKEN="$(bw get password APIKEY-pushover-apikey)" export APP_TOKEN="$(bw get password APIKEY-pushover-apptoken)" } post_message() { MESSAGE=$1 TITLE="Daily Routine Reminder" wget https://api.pushover.net/1/messages.json --post-data="token=$APP_TOKEN&user=$USER_TOKEN&message=$MESSAGE&title=$TITLE" -qO- > /dev/null 2>&1 & } export PASSED_MSG="$1" secrets_manager post_message $PASSED_MSG