From 8d6bee71440b4bc57df9ee4c4f359b0f0d7cfb56 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Tue, 8 Jun 2021 08:36:01 +0200 Subject: [PATCH] Adds local . file config options --- src/.gitignore | 1 + src/octojpack | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/.gitignore b/src/.gitignore index 46c7786..1521af8 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1,4 +1,5 @@ conf.json packager licenses +.octojpack .env \ No newline at end of file diff --git a/src/octojpack b/src/octojpack index dbe5b9b..1a98e63 100755 --- a/src/octojpack +++ b/src/octojpack @@ -3,7 +3,7 @@ # Program name PROGRAM_NAME="Octojpack" PROGRAM_CODE="octojpack" -PROGRAM_VERSION="1.0.0" +PROGRAM_VERSION="1.0.1" PROGRAM_V="1.0" PROGRAM_URL="https://git.vdm.dev/octoleo/${PROGRAM_CODE}" @@ -1055,9 +1055,13 @@ tmp_path="/home/$USER/${PROGRAM_CODE}" PACKAGE_DIR="${PACKAGE_DIR:-$tmp_path}" # we set the licenses directory tmp_path="/home/$USER/${PROGRAM_CODE}/licenses" +# if path not set try $PWD path +[ -d "$tmp_path" ] || tmp_path="$PWD" LICENSE_DIR="${LICENSE_DIR:-$tmp_path}" # the environment variables path tmp_path="/home/$USER/.config/${PROGRAM_CODE}/.env" +# if path not set try $PWD path +[ -f "$tmp_path" ] || tmp_path="$PWD/.env" VDM_ENV_FILE_PATH="${VDM_ENV_FILE_PATH:-$tmp_path}" # car this tmp out unset tmp_path @@ -1205,6 +1209,10 @@ done # shellcheck disable=SC1090 [ -f "${VDM_ENV_FILE_PATH}" ] && source "${VDM_ENV_FILE_PATH}" +# if path not set try $PWD path (so you can open a folder that has .octojpack file and it will be loaded) +tmp_path="$PWD/.${PROGRAM_CODE}" +VDM_PACKAGE_CONF_FILE="${VDM_PACKAGE_CONF_FILE:-$tmp_path}" + # check if the config is passed via a URL if [[ "${VDM_PACKAGE_CONF_FILE}" =~ ^"http:" ]] || [[ "${VDM_PACKAGE_CONF_FILE}" =~ ^"https:" ]]; then # shellcheck disable=SC2143