Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src/lib/config.sh
diff options
context:
space:
mode:
authorChristian Heusel <christian@heusel.eu>2023-02-13 14:58:42 +0100
committerLevente Polyak <anthraxx@archlinux.org>2023-05-20 00:08:12 +0200
commit5e22e4f81e61f4ad2228366439be00b691284894 (patch)
tree21073e1d71a9f1f318effe6d8fe37bc46f86f2f4 /src/lib/config.sh
parenta981ef40e84398475cfe04ac49b8118385249a96 (diff)
config: allow suppying the gitlab token via env var
This would allow to supply the gitlab tokens via the env var DEVTOOLS_GITLAB_TOKEN and therefore allow users to choose whatever program they want to fill this env var. Closes #113 Signed-off-by: Christian Heusel <christian@heusel.eu> Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
Diffstat (limited to 'src/lib/config.sh')
-rw-r--r--src/lib/config.sh10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/config.sh b/src/lib/config.sh
index 5034c6e..ba6532e 100644
--- a/src/lib/config.sh
+++ b/src/lib/config.sh
@@ -14,11 +14,15 @@ readonly XDG_DEVTOOLS_GITLAB_CONFIG="${XDG_DEVTOOLS_DIR}/gitlab.conf"
export GITLAB_TOKEN=""
load_devtools_config() {
- if [[ ! -f "${XDG_DEVTOOLS_GITLAB_CONFIG}" ]]; then
- GITLAB_TOKEN=""
+ if [[ -n "${DEVTOOLS_GITLAB_TOKEN}" ]]; then
+ GITLAB_TOKEN="${DEVTOOLS_GITLAB_TOKEN}"
return
fi
- GITLAB_TOKEN=$(grep GITLAB_TOKEN "${XDG_DEVTOOLS_GITLAB_CONFIG}"|cut -d= -f2|cut -d\" -f2)
+ if [[ -f "${XDG_DEVTOOLS_GITLAB_CONFIG}" ]]; then
+ GITLAB_TOKEN=$(grep GITLAB_TOKEN "${XDG_DEVTOOLS_GITLAB_CONFIG}"|cut -d= -f2|cut -d\" -f2)
+ return
+ fi
+ GITLAB_TOKEN=""
}
save_devtools_config() {