aboutsummaryrefslogtreecommitdiffstats
path: root/installation/sdnc-web
diff options
context:
space:
mode:
authorMichael DÜrre <michael.duerre@highstreet-technologies.com>2021-02-11 07:27:49 +0100
committerMichael DÜrre <michael.duerre@highstreet-technologies.com>2021-02-11 07:27:59 +0100
commit8d6c3538ebaad19a744408980cfbd636931de915 (patch)
tree2f1c1f1ef64bf2d895cadcebeddb790e912105be /installation/sdnc-web
parent1618d5c24a05253bcddb13a510eb18f1742d6d8c (diff)
update sdnc-web image
handle new env vars during startup Issue-ID: SDNC-1478 Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com> Change-Id: Id472e21a235fa11e03a9f1441313658fe48e1eb3 Former-commit-id: 887b16594fbbf6551d22922c8bdd37e8f0d47ee2
Diffstat (limited to 'installation/sdnc-web')
-rw-r--r--installation/sdnc-web/src/main/scripts/configure.sh19
1 files changed, 18 insertions, 1 deletions
diff --git a/installation/sdnc-web/src/main/scripts/configure.sh b/installation/sdnc-web/src/main/scripts/configure.sh
index cf53a0d9..a257e6e1 100644
--- a/installation/sdnc-web/src/main/scripts/configure.sh
+++ b/installation/sdnc-web/src/main/scripts/configure.sh
@@ -28,7 +28,24 @@ update_index_html() {
# Backup the index.html file
cp /opt/bitnami/nginx/html/odlux/index.html /opt/bitnami/nginx/html/odlux/index.html.backup
- sed -z 's/<script>[^<]*<\/script>/<script>\n \/\/ run the application \n require\(\[\"connectApp\",\"faultApp\",\"maintenanceApp\",\"configurationApp\",\"performanceHistoryApp\",\"inventoryApp\",\"eventLogApp\",\"mediatorApp\",\"networkMapApp\",\"linkCalculationApp\",\"helpApp\",\"run\"\], function \(connectApp,faultApp,maintenanceApp,configurationApp,performanceHistoryApp,inventoryApp,eventLogApp,mediatorApp,networkMapApp,linkCalculationApp,helpApp,run\) \{ \n connectApp.register\(\); \n faultApp.register\(\);\n maintenanceApp.register\(\); \n configurationApp.register\(\);\n performanceHistoryApp.register\(\); \n inventoryApp.register\(\);\n eventLogApp.register\(\);\n mediatorApp.register\(\);\n networkMapApp.register\(\);\n linkCalculationApp.register\(\);\n helpApp.register\(\);\n run.runApplication();\n \}\);\n <\/script>/' -i /opt/bitnami/nginx/html/odlux/index.html
+ #default values
+ ODLUX_AUTH_METHOD="basic"
+ ENABLE_ODLUX_RBAC=${ENABLE_ODLUX_RBAC:-false}
+
+ if [ "$ENABLE_OAUTH" == "true" ]; then
+ ODLUX_AUTH_METHOD="oauth"
+ fi
+ echo "authentication is $ODLUX_AUTH_METHOD"
+ echo "rbac access is enabled: $ENABLE_ODLUX_RBAC"
+ ODLUX_CONFIG='{"authentication":"'$ODLUX_AUTH_METHOD'","enablePolicy":'$ENABLE_ODLUX_RBAC'}'
+# sed -z 's/<script>[^<]*<\/script>/<script>\n \/\/ run the application \n require\(\[\"connectApp\",\"faultApp\",\"maintenanceApp\",\"configurationApp\",\"performanceHistoryApp\",\"inventoryApp\",\"eventLogApp\",\"mediatorApp\",\"networkMapApp\",\"linkCalculationApp\",\"helpApp\",\"run\"\], function \(connectApp,faultApp,maintenanceApp,configurationApp,performanceHistoryApp,inventoryApp,eventLogApp,mediatorApp,networkMapApp,linkCalculationApp,helpApp,run\) \{ \n run.configure('$ODLUX_CONFIG'); \n connectApp.register\(\); \n faultApp.register\(\);\n maintenanceApp.register\(\); \n configurationApp.register\(\);\n performanceHistoryApp.register\(\); \n inventoryApp.register\(\);\n eventLogApp.register\(\);\n mediatorApp.register\(\);\n networkMapApp.register\(\);\n linkCalculationApp.register\(\);\n helpApp.register\(\);\n run.runApplication();\n \}\);\n <\/script>/' -i /opt/bitnami/nginx/html/odlux/index.html
+
+ #replace require expression
+ sed -z 's/require(\["run"\],\ function\ (run)/require\(\[\"connectApp\",\"faultApp\",\"maintenanceApp\",\"configurationApp\",\"performanceHistoryApp\",\"inventoryApp\",\"eventLogApp\",\"mediatorApp\",\"networkMapApp\",\"linkCalculationApp\",\"helpApp\",\"run\"\], function \(connectApp,faultApp,maintenanceApp,configurationApp,performanceHistoryApp,inventoryApp,eventLogApp,mediatorApp,networkMapApp,linkCalculationApp,helpApp,run\)/' -i /opt/bitnami/nginx/html/odlux/index.html
+ #replace run.runApplication expression
+ sed -z 's/run.runApplication();/connectApp.register\(\); \n faultApp.register\(\);\n maintenanceApp.register\(\); \n configurationApp.register\(\);\n performanceHistoryApp.register\(\); \n inventoryApp.register\(\);\n eventLogApp.register\(\);\n mediatorApp.register\(\);\n networkMapApp.register\(\);\n linkCalculationApp.register\(\);\n helpApp.register\(\);\n run.runApplication();/' -i /opt/bitnami/nginx/html/odlux/index.html
+ #replace run.configure expression if exists
+ sed -z 's/run.configureApplication([^)]\+)/run.configureApplication('$ODLUX_CONFIG');/' -i /opt/bitnami/nginx/html/odlux/index.html
}