31 lines
621 B
Bash
Executable File
31 lines
621 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|
jar_file="$script_dir/ollama-oai-bridge.jar"
|
|
|
|
if [[ ! -f "$jar_file" ]]; then
|
|
echo "Jar not found: $jar_file" >&2
|
|
exit 1
|
|
fi
|
|
|
|
java_opts=()
|
|
if [[ -n "${JAVA_OPTS:-}" ]]; then
|
|
read -r -a java_opts <<<"${JAVA_OPTS}"
|
|
fi
|
|
|
|
app_opts=()
|
|
if [[ -n "${OLLAMA_OAI_BRIDGE_OPTS:-}" ]]; then
|
|
read -r -a app_opts <<<"${OLLAMA_OAI_BRIDGE_OPTS}"
|
|
fi
|
|
|
|
for arg in "$@"; do
|
|
if [[ "$arg" == -D* ]]; then
|
|
java_opts+=("$arg")
|
|
else
|
|
app_opts+=("$arg")
|
|
fi
|
|
done
|
|
|
|
exec java "${java_opts[@]}" -jar "$jar_file" "${app_opts[@]}" |