Skip to content

Commit

Permalink
feat: change docker entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoinier committed Jul 16, 2024
1 parent cf7492f commit 4c5b8c8
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 19 deletions.
2 changes: 1 addition & 1 deletion apps/datahub/src/main.ts
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
20 changes: 2 additions & 18 deletions conf/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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']
30 changes: 30 additions & 0 deletions tools/docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 4c5b8c8

Please sign in to comment.