snipe-it/init.sh

12 lines
406 B
Bash
Raw Permalink Normal View History

2022-10-13 13:14:23 +00:00
#!/usr/bin/env bash
set -e
# Retrieve proper environment variables
SNIPEIT_VERSION=$(cat .env | grep SNIPEIT_VERSION | sed 's/SNIPEIT_VERSION=//')
# Generate a new key (escaped for `sed` use)
SNIPEIT_KEY=$(docker run --rm snipe/snipe-it:${SNIPEIT_VERSION} | grep base64 | sed -e 's/[\/&]/\\&/g')
# Place the newly generated key in the env file
sed -i "s/SNIPEIT_KEY=.*/SNIPEIT_KEY=${SNIPEIT_KEY}/" .env