12 lines
406 B
Bash
12 lines
406 B
Bash
|
#!/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
|