Skip to content

Commit

Permalink
update add header script with work upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanmi151 committed Feb 11, 2025
1 parent b8f28ce commit 57409b2
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions config/scripts/add-header-webcomponent.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
#!/bin/sh

# This script needs to be executable in order to run during the initialization phase
# It might be required to `chmod +x` the file
# To be properl executed by maelstro initialization need the +x flag
# so you need to add it with chmod and commit/push it
# To be properl executed by maelstro initialization need the +x flag
# so you need to add it with chmod and commit/push it
function prop {
variable=$(grep "^${1}" /etc/georchestra/default.properties)
if [[ -z $variable ]] || [[ $variable == \#* ]] ;
then
echo ${2}
else
echo $variable | cut -d'=' -f2
fi
#one-line version [[ -z $variable ]] || [[ $variable == \#* ]] && echo ${2} || echo $variable | cut -d'=' -f2
}

STYLESHEET=$(prop "georchestraStylesheet" "")
SCRIPT=$(prop "headerScript" "https://cdn.jsdelivr.net/gh/georchestra/header@dist/header.js")
HEIGHT=$(prop "headerHeight" "80")
LEGACY=$(prop "useLegacyHeader" "false")
LEGACY_URL=$(prop "headerUrl" "/header")
LOGO=$(prop "logoUrl" "https://www.georchestra.org/public/georchestra-logo.svg")
CONFIG_FILE=$(prop "headerConfigFile" "")

MAELSTRO_DIR=${1:-/app}
SNIPPET="<script src='https://cdn.jsdelivr.net/gh/georchestra/header@dist/header.js'></script><geor-header active-app='maelstro' style='height:90px'></geor-header>"
SNIPPET="<script src='${SCRIPT}'></script><geor-header active-app='maelstro' config-file='${CONFIG_FILE}' logo-url='${LOGO}' legacy-header='${LEGACY}' legacy-url='${LEGACY_URL}' height='${HEIGHT}' stylesheet='${STYLESHEET}'></geor-header>"

if grep -q "${SNIPPET}" "${MAELSTRO_DIR}/index.html"; then
echo "[INFO] geOrchestra: header already present."
Expand Down

0 comments on commit 57409b2

Please sign in to comment.