-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from zazuko/docker-env
[Docker] Allow the use of environment variables for the configuration
- Loading branch information
Showing
6 changed files
with
113 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/sh | ||
|
||
################################################################## | ||
# Check for required environment variables # | ||
# In case they are not set, use default config.json file instead # | ||
################################################################## | ||
|
||
if [ -z "${ENDPOINT_URL}" ]; then | ||
echo "ENDPOINT_URL is not set, let's keep the current config.json file." | ||
exit 0 | ||
fi | ||
|
||
######################################################### | ||
# Set default values for optional environment variables # | ||
######################################################### | ||
|
||
if [ -z "${SPARQL_CONSOLE_URL}" ]; then | ||
echo "SPARQL_CONSOLE_URL is not set, let's use 'http://example.com/sparql/#query' as default value." | ||
SPARQL_CONSOLE_URL="http://example.com/sparql/#query" | ||
fi | ||
|
||
if [ -z "${GRAPH_EXPLORER_URL}" ]; then | ||
echo "GRAPH_EXPLORER_URL is not set, let's use 'http://example.com/graph-explorer/?resource' as default value." | ||
GRAPH_EXPLORER_URL="http://example.com/graph-explorer/?resource" | ||
fi | ||
|
||
if [ -z "${FULL_TEXT_SEARCH_DIALECT}" ]; then | ||
echo "FULL_TEXT_SEARCH_DIALECT is not set, let's use 'fuseki' as default value." | ||
FULL_TEXT_SEARCH_DIALECT="fuseki" | ||
fi | ||
|
||
if [ -z "${NEPTUNE_FTS_ENDPOINT}" ]; then | ||
# Check if the full-text search endpoint is set to "neptune", and only display the warning message in this case | ||
if [ "${FULL_TEXT_SEARCH_DIALECT}" = "neptune" ]; then | ||
echo "NEPTUNE_FTS_ENDPOINT is not set, let's use 'http://example.com/' as default value." | ||
fi | ||
NEPTUNE_FTS_ENDPOINT="http://example.com/" | ||
fi | ||
|
||
######################################################## | ||
# Generate config.json file from environment variables # | ||
######################################################## | ||
|
||
echo "Generating config.json file with the following values:" | ||
echo "- ENDPOINT_URL: ${ENDPOINT_URL}" | ||
echo "- SPARQL_CONSOLE_URL: ${SPARQL_CONSOLE_URL}" | ||
echo "- GRAPH_EXPLORER_URL: ${GRAPH_EXPLORER_URL}" | ||
echo "- FULL_TEXT_SEARCH_DIALECT: ${FULL_TEXT_SEARCH_DIALECT}" | ||
echo "- NEPTUNE_FTS_ENDPOINT: ${NEPTUNE_FTS_ENDPOINT}" | ||
|
||
jq -n \ | ||
--arg endpointUrl "${ENDPOINT_URL}" \ | ||
--arg sparqlConsoleUrl "${SPARQL_CONSOLE_URL}" \ | ||
--arg graphExplorerUrl "${GRAPH_EXPLORER_URL}" \ | ||
--arg fullTextSearchDialect "${FULL_TEXT_SEARCH_DIALECT}" \ | ||
--arg ftsEndpoint "${NEPTUNE_FTS_ENDPOINT}" \ | ||
'{ | ||
"endpointUrl": $endpointUrl, | ||
"sparqlConsoleUrl": $sparqlConsoleUrl, | ||
"graphExplorerUrl": $graphExplorerUrl, | ||
"fullTextSearchDialect": $fullTextSearchDialect, | ||
"neptune": { | ||
"ftsEndpoint": $ftsEndpoint | ||
} | ||
}' > /app/config.json | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters