Both --input and --url are optional (#24)
- They are no longer mutually exclusive - Input-independent default graph-cache location - `/data/default-gh' - Resolve #23 Technical changes: - Simplify handling: of script variables and their defaults - Remove complex configuration handling and copy - Remove unused variables - Modify "our" copy of `config-example.yml` to enable http connections from outside of the container - Update and clarify the help text
هذا الالتزام موجود في:
@@ -17,21 +17,20 @@ echo "## using java $vers from $JAVA_HOME"
|
||||
|
||||
function printBashUsage {
|
||||
echo "$(basename $0): Start a Gpahhopper server."
|
||||
echo "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 "Usage"
|
||||
echo "$(basename $0) -i | --input <file> [<parameter> ...] "
|
||||
echo "$(basename $0) --url <url> [<parameter> ...] "
|
||||
echo "$(basename $0) [<parameter> ...] "
|
||||
echo ""
|
||||
echo "parameters:"
|
||||
echo "--import only create the graph cache, to be used later for faster starts"
|
||||
echo "-c | --config <config> specify the application configuration"
|
||||
echo "-i | --input <file> path to the input file in the file system"
|
||||
echo "-i | --input <osm-file> OSM local input file location"
|
||||
echo "--url <url> download input file from a url and save as data.pbf"
|
||||
echo "--import only create the graph cache, to be used later for faster starts"
|
||||
echo "-c | --config <config> application configuration file location"
|
||||
echo "-o | --graph-cache <dir> directory for graph cache output"
|
||||
echo "-p | --profiles <string> comma separated list of vehicle profiles"
|
||||
echo "--port <port> start web server at the given port rather than 8989"
|
||||
echo "--host <host> specify to which host the service should be bound rather than 0.0.0.0"
|
||||
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 message"
|
||||
}
|
||||
|
||||
@@ -55,49 +54,21 @@ while [ ! -z $1 ]; do
|
||||
esac
|
||||
done
|
||||
|
||||
# Defaults
|
||||
: "${ACTION:=server}"
|
||||
|
||||
if [[ "$CONFIG" == *properties ]]; then
|
||||
echo "$CONFIG not allowed as configuration. Use yml"
|
||||
exit
|
||||
fi
|
||||
|
||||
# default init, https://stackoverflow.com/a/28085062/194609
|
||||
: "${CONFIG:=config.yml}"
|
||||
if [[ -f $CONFIG && $CONFIG != config.yml ]]; then
|
||||
echo "Copying non-default config file: $CONFIG"
|
||||
cp $CONFIG config.yml
|
||||
fi
|
||||
if [ ! -f "config.yml" ]; then
|
||||
echo "No config file was specified, using config-example.yml"
|
||||
cp config-example.yml $CONFIG
|
||||
fi
|
||||
|
||||
if [ "$URL" != "" ]; then
|
||||
wget -S -nv -O "data.pbf" "$URL"
|
||||
FILE="data.pbf"
|
||||
fi
|
||||
|
||||
if [ "$FILE" = "" ]; then
|
||||
echo -e "No file or url were specified."
|
||||
printBashUsage
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# DATA_DIR = directories path to the file if any (if current directory, return .)
|
||||
DATADIR=$(dirname "${FILE}")
|
||||
# create the directories if needed
|
||||
mkdir -p $DATADIR
|
||||
# BASENAME = filename (file without the directories)
|
||||
BASENAME=$(basename "${FILE}")
|
||||
# NAME = file without extension if any
|
||||
NAME="${BASENAME%.*}"
|
||||
|
||||
: "${GRAPH:=/data/default-gh}"
|
||||
: "${CONFIG:=config-example.yml}"
|
||||
: "${JAVA_OPTS:=-Xmx1g -Xms1g}"
|
||||
: "${JAR:=$(find . -type f -name "*.jar")}"
|
||||
: "${GRAPH:=$DATADIR/$NAME-gh}"
|
||||
|
||||
if [ "$URL" != "" ]; then
|
||||
wget -S -nv -O "${FILE:=data.pbf}" "$URL"
|
||||
fi
|
||||
|
||||
# create the directories if needed
|
||||
mkdir -p $(dirname "${GRAPH}")
|
||||
|
||||
echo "## Executing $ACTION. JAVA_OPTS=$JAVA_OPTS"
|
||||
|
||||
exec "$JAVA" $JAVA_OPTS -Ddw.graphhopper.datareader.file="$FILE" -Ddw.graphhopper.graph.location="$GRAPH" \
|
||||
exec "$JAVA" $JAVA_OPTS ${FILE:+-Ddw.graphhopper.datareader.file="$FILE"} -Ddw.graphhopper.graph.location="$GRAPH" \
|
||||
$GH_WEB_OPTS -jar "$JAR" $ACTION $CONFIG
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم