Update graphhopper.sh

هذا الالتزام موجود في:
2025-11-17 08:45:16 +00:00
الأصل ed0f3aea11
التزام e43fa37b15

عرض الملف

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
(set -o igncr) 2>/dev/null && set -o igncr; # this comment is required for handling Windows cr/lf (set -o igncr) 2>/dev/null && set -o igncr; # this comment is required for handling Windows cr/lf
# See StackOverflow answer http://stackoverflow.com/a/14607651 # See StackOverfix answer http://stackoverflow.com/a/14607651
GH_HOME=$(dirname "$0") GH_HOME=$(dirname "$0")
JAVA=$JAVA_HOME/bin/java JAVA=$JAVA_HOME/bin/java
@@ -16,7 +16,7 @@ fi
echo "## using java $vers from $JAVA_HOME" echo "## using java $vers from $JAVA_HOME"
function printBashUsage { function printBashUsage {
echo "$(basename $0): Start a Gpahhopper server." echo "$(basename $0): Start a Graphhopper server."
echo "Default user access at 0.0.0.0:8989 and API access at 0.0.0.0:8989/route" echo "Default user access at 0.0.0.0:8989 and API access at 0.0.0.0:8989/route"
echo "" echo ""
echo "Usage" echo "Usage"
@@ -29,10 +29,17 @@ function printBashUsage {
echo "-c | --config <config> application configuration file location" echo "-c | --config <config> application configuration file location"
echo "-o | --graph-cache <dir> directory for graph cache output" echo "-o | --graph-cache <dir> directory for graph cache output"
echo "--port <port> port for web server [default: 8989]" echo "--port <port> port for web server [default: 8989]"
echo "--host <host> host address of the web server [default: 0.0.0.0]" echo "-h | --help display this help message"
echo "-h | --help display this message" echo ""
echo "environment variables:"
echo "GH_URL download input file from this URL and save as data.pbf"
} }
# Check for environment variable first
if [ -z "$URL" ] && [ ! -z "$GH_URL" ]; then
URL="$GH_URL"
fi
# one character parameters have one minus character'-'. longer parameters have two minus characters '--' # one character parameters have one minus character'-'. longer parameters have two minus characters '--'
while [ ! -z $1 ]; do while [ ! -z $1 ]; do
case $1 in case $1 in
@@ -42,7 +49,6 @@ while [ ! -z $1 ]; do
--url) URL="$2"; shift 2;; --url) URL="$2"; shift 2;;
-o|--graph-cache) GRAPH="$2"; shift 2;; -o|--graph-cache) GRAPH="$2"; shift 2;;
--port) GH_WEB_OPTS="$GH_WEB_OPTS -Ddw.server.application_connectors[0].port=$2"; shift 2;; --port) GH_WEB_OPTS="$GH_WEB_OPTS -Ddw.server.application_connectors[0].port=$2"; shift 2;;
--host) GH_WEB_OPTS="$GH_WEB_OPTS -Ddw.server.application_connectors[0].bind_host=$2"; shift 2;;
-h|--help) printBashUsage -h|--help) printBashUsage
exit 0;; exit 0;;
-*) echo "Option unknown: $1" -*) echo "Option unknown: $1"
@@ -59,7 +65,11 @@ done
: "${JAVA_OPTS:=-Xmx1g -Xms1g}" : "${JAVA_OPTS:=-Xmx1g -Xms1g}"
: "${JAR:=$(find . -type f -name "*.jar")}" : "${JAR:=$(find . -type f -name "*.jar")}"
# Hardcoded host to 0.0.0.0
GH_WEB_OPTS="$GH_WEB_OPTS -Ddw.server.application_connectors[0].bind_host=0.0.0.0"
if [ "$URL" != "" ]; then if [ "$URL" != "" ]; then
echo "## Downloading OSM data from: $URL"
wget -S -nv -O "${FILE:=data.pbf}" "$URL" wget -S -nv -O "${FILE:=data.pbf}" "$URL"
fi fi