From 1dc2ba18d46ba07ad770620762e5c90704dadbfc Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 16 Nov 2022 16:15:00 +0100 Subject: [PATCH] general way to copy assets using env variables --- .env.sample | 1 + abra.sh | 23 +++++++---------------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/.env.sample b/.env.sample index c3669db..8f16be9 100644 --- a/.env.sample +++ b/.env.sample @@ -33,3 +33,4 @@ AUTHENTIK_COLOR_BACKGROUND_LIGHT=#1c1e21 WELCOME_MESSAGE="Welcome to Authentik" DEFAULT_LANGUAGE=en AUTHENTIK_FOOTER_LINKS='[{"name": "My Organization","href":"https://example.com"}]' +COPY_ASSETS="flow_background.jpg|app:/web/dist/assets/images/ icon_left_brand.svg|app:/web/dist/assets/icons/ icon.png|app:/web/dist/assets/icons/" diff --git a/abra.sh b/abra.sh index 6ee977a..788dbfe 100644 --- a/abra.sh +++ b/abra.sh @@ -7,22 +7,13 @@ customize() { echo "Usage: ... customize " exit 1 fi - # TODO: use env to specify source and target files - if [ -e $1/flow_background.jpg ] - then - echo copy flow_background.jpg - abra app cp $APP_NAME $1/flow_background.jpg app:/web/dist/assets/images/ - fi - if [ -e $1/icon_left_brand.svg ] - then - echo copy icon_left_brand.svg - abra app cp $APP_NAME $1/icon_left_brand.svg app:/web/dist/assets/icons/ - fi - if [ -e $1/icon.png ] - then - echo copy icon.png - abra app cp $APP_NAME $1/icon.png app:/web/dist/assets/icons/ - fi + asset_dir=$1 + for asset in $COPY_ASSETS; do + source=$(echo $asset | cut -d "|" -f1) + target=$(echo $asset | cut -d "|" -f2) + echo copy $source to $target + abra app cp $APP_NAME $asset_dir/$source $target + done } set_admin_pass() {