infctl-cli/scripts/create_app_secret_ctl.sh
jon brookes 924954d0ff changed app to use json config for pipeline steps
readme command line usage - to specify pipeline file name
readme updated to include reasoning behind the project

use native golang sqlite

RunScriptCommand named in functionMap
removed unused functions
removed unused functions
run script and pipeline example
renamed functions to drop the word script and add pipeline verb
2025-07-14 16:34:15 +01:00

28 lines
No EOL
697 B
Bash
Executable file

#!/usr/bin/env bash
if kubectl get secret app-key-secret -n infctl >/dev/null 2>&1; then
echo "Secret app-key-secret already exists in namespace infctl. Exiting."
exit 0
fi
generate_app_key() {
APP_KEY=$(docker run --rm \
--entrypoint /bin/sh \
$APP_CONTAINER \
-c "cd /var/www && \
cp .env.example .env && \
php artisan key:generate --force > /dev/null 2>&1 && \
grep 'APP_KEY' .env | sed 's/APP_KEY=//'")
APP_KEY=$(echo "$APP_KEY" | tr -d '\r\n')
}
generate_app_key
echo "Extracted APP_KEY: $APP_KEY"
kubectl create secret generic app-key-secret \
--from-literal=app_key="$APP_KEY" \
-n infctl --dry-run=client -o yaml | kubectl apply -f -