aboutsummaryrefslogtreecommitdiffstats
path: root/run/tool.sh
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-06-06 08:52:40 +0800
committerGitHub <noreply@github.com>2024-06-06 08:52:40 +0800
commit7d5b14bca135ce521a48c00e54e2e34c7bb76773 (patch)
tree5e55922192bb8f774d603e7cac6e453f2ee32fa6 /run/tool.sh
parentbfb7d75fe47ea588495c5be8157a67b1fec67a13 (diff)
downloadllm-functions-docker-7d5b14bca135ce521a48c00e54e2e34c7bb76773.tar.gz
feat: support dotenv (#18)
Diffstat (limited to 'run/tool.sh')
-rwxr-xr-xrun/tool.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/run/tool.sh b/run/tool.sh
index 4846c8e..faafddd 100755
--- a/run/tool.sh
+++ b/run/tool.sh
@@ -1,6 +1,12 @@
#!/usr/bin/env bash
set -e
+export LLM_FUNCTIONS_DIR="$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd)"
+
+if [[ -f "$LLM_FUNCTIONS_DIR/.env" ]]; then
+ source "$LLM_FUNCTIONS_DIR/.env"
+fi
+
if [[ "$0" == *tool.sh ]]; then
FUNC_FILE="$1"
FUNC_DATA="$2"
@@ -12,8 +18,7 @@ if [[ "$FUNC_FILE" != *'.sh' ]]; then
FUNC_FILE="$FUNC_FILE.sh"
fi
-PROJECT_DIR="$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd)"
-FUNC_FILE="$PROJECT_DIR/tools/$FUNC_FILE"
+FUNC_FILE="$LLM_FUNCTIONS_DIR/tools/$FUNC_FILE"
if [[ "$OS" == "Windows_NT" ]]; then
FUNC_FILE="$(cygpath -w "$FUNC_FILE")"