From 4c5b8c8db8927add6e26f11a25f0bbbb37635707 Mon Sep 17 00:00:00 2001 From: Camille Moinier Date: Tue, 16 Jul 2024 12:57:56 +0200 Subject: [PATCH] feat: change docker entrypoint --- apps/datahub/src/main.ts | 2 +- conf/default.toml | 20 ++------------------ tools/docker/docker-entrypoint.sh | 30 ++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/apps/datahub/src/main.ts b/apps/datahub/src/main.ts index 39493282..3008bf40 100644 --- a/apps/datahub/src/main.ts +++ b/apps/datahub/src/main.ts @@ -1,6 +1,6 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' import { AppModule } from './app/app.module' -import { loadAppConfig } from 'geonetwork-ui' +import { loadAppConfig } from 'libs/util/app-config/src/lib/app-config' loadAppConfig().then(() => { platformBrowserDynamic() diff --git a/conf/default.toml b/conf/default.toml index 11b56375..c997786d 100644 --- a/conf/default.toml +++ b/conf/default.toml @@ -7,22 +7,6 @@ [search] # The advanced search filters available to the user can be customized with this setting. -# The following fields can be used for filtering: 'publisher', 'format', 'publicationYear', 'inspireKeyword', 'keyword', 'topic', 'isSpatial', 'license', 'resourceType', 'representationType', 'revisionYear', 'categoryKeyword', 'qualityScore', 'territories' +# The following fields can be used for filtering: 'organization', 'format', 'publicationYear', 'inspireKeyword', 'keyword', 'topic', 'isSpatial', 'license', 'resourceType', 'representationType', 'revisionYear', 'categoryKeyword', 'qualityScore', 'territories', 'publisherOrg', 'producerOrg' # any other field will be ignored -# advanced_filters = ['format', 'topic', 'resourceType', 'representationType'] - -### GLOBAL SETTINGS - -[global] -# This URL (relative or absolute) must point to the API endpoint of a GeoNetwork4 instance -# NOT USED AT THE MOMENT BUT MANDATORY -geonetwork4_api_url = "/geonetwork/srv/api" - -### VISUAL THEME - -# NOT USED AT THE MOMENT BUT MANDATORY -[theme] -primary_color = "#c82850" -secondary_color = "#001638" -main_color = "#555" -background_color = "#fdfbff" +advanced_filters = ['format', 'topic', 'resourceType', 'representationType', 'publisherOrg', 'producerOrg'] diff --git a/tools/docker/docker-entrypoint.sh b/tools/docker/docker-entrypoint.sh index 93a58f7a..147bae9e 100755 --- a/tools/docker/docker-entrypoint.sh +++ b/tools/docker/docker-entrypoint.sh @@ -1,5 +1,35 @@ #!/bin/bash +APP_FILES_PATH=/usr/share/nginx/html/${APP_NAME}/ + +CONFIG_FILE_PATH=assets/configuration/ +CONFIG_FILE_NAME=default.toml +CONFIG_OVERRIDE_FILE_PATH=${CONFIG_DIRECTORY_OVERRIDE:-/conf}/${CONFIG_FILE_NAME} + +## 1. COPY CONFIG FILE + +# check if conf file from $CONFIG_DIRECTORY_OVERRIDE (defaults to /conf) is present +if [ -f "${CONFIG_OVERRIDE_FILE_PATH}" ] +then + # copy file straight to the assets + echo "[INFO] Copying custom configuration file located at ${CONFIG_OVERRIDE_FILE_PATH}..." + cp ${CONFIG_OVERRIDE_FILE_PATH} ${APP_FILES_PATH}${CONFIG_FILE_PATH}${CONFIG_FILE_NAME} +else + # no conf file; use env variables to tweak app config + echo "[INFO] No custom configuration file found at ${CONFIG_OVERRIDE_FILE_PATH}" + # Modify the GN4 url and proxy path based on env variables (if defined) + if [ ! -z "${GN4_API_URL}" ] + then + echo "[INFO] Replacing GN4 url in conf with: ${GN4_API_URL}..." + sed -i "s%geonetwork4_api_url = \".*\"%geonetwork4_api_url = \"${GN4_API_URL}\"%" ${APP_FILES_PATH}${CONFIG_FILE_PATH}${CONFIG_FILE_NAME} + fi + if [ ! -z "${PROXY_PATH}" ] + then + echo "[INFO] Replacing proxy path in conf with: ${PROXY_PATH}..." + sed -i "s%proxy_path = \".*\"%proxy_path = \"${PROXY_PATH}\"%" ${APP_FILES_PATH}${CONFIG_FILE_PATH}${CONFIG_FILE_NAME} + fi +fi + # Executing custom scripts located in CUSTOM_SCRIPTS_DIRECTORY if environment variable is set if [[ -z "${CUSTOM_SCRIPTS_DIRECTORY}" ]]; then echo "[INFO] No CUSTOM_SCRIPTS_DIRECTORY env variable set"