Page MenuHomec4science

.clean-api-key
No OneTemporary

File Metadata

Created
Sat, Nov 30, 11:15

.clean-api-key

#!/bin/bash
action=$1
file=$2
secure_place=.git_secure/
secure_file=${secure_place}/${file}-token
if [ "$action" == "-clean" ]; then
mkdir -p ${secure_place}
token=$(grep token ${file} | sed -E "s/.*token: +((cli-|api-)[a-z0-9]{28}).*/\1/")
echo ${token} > ${secure_file}
sed ${file} -e "s/${token}/cli-n5dutb2wv26ivcpo66yvb3sbk64g/"
fi
if [ "$action" == "-smudge" ]; then
if [ -f ${secure_file} ]; then
token=$(cat ${secure_file})
sed ${file} -e "s/cli-n5dutb2wv26ivcpo66yvb3sbk64g/${token}/"
fi
fi

Event Timeline