summaryrefslogtreecommitdiff
path: root/utils/brand.sh
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2024-01-07 18:33:34 +0100
committerMarkus Heiser <markus.heiser@darmarIT.de>2024-01-09 16:31:19 +0100
commitf9c5727ddc74b9ee3bb95225c30f57c7aeb14806 (patch)
tree9cda98183b0efcbca8ba45b53d9502a36a0201a3 /utils/brand.sh
parent60bc5baea31c24a72cfb4f45322e326cc62caf23 (diff)
downloadsearxng-f9c5727ddc74b9ee3bb95225c30f57c7aeb14806.tar.gz
searxng-f9c5727ddc74b9ee3bb95225c30f57c7aeb14806.zip
[mod] get rid of ./utils/brand.env and its workflow
All the environments defined in ./utils/brand.env are generated on the fly, so there is no longer a need to define the brand environment in this file and all the workflows to handle this file. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'utils/brand.sh')
-rwxr-xr-xutils/brand.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/utils/brand.sh b/utils/brand.sh
new file mode 100755
index 000000000..1749efb31
--- /dev/null
+++ b/utils/brand.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: AGPL-3.0-or-later
+
+# shellcheck source=utils/lib.sh
+. /dev/null
+
+build.env.export() {
+ GIT_BRANCH="$(git branch | grep '\*' | cut -d' ' -f2-)"
+ GIT_REMOTE="$(git config "branch.${GIT_BRANCH}.remote")"
+ GIT_URL="$(git config --get "remote.${GIT_REMOTE}.url")"
+ if [[ "${GIT_URL}" == git@* ]]; then
+ GIT_URL="${GIT_URL/://}"
+ GIT_URL="${GIT_URL/git@/https://}"
+ fi
+ if [[ "${GIT_URL}" == *.git ]]; then
+ GIT_URL="${GIT_URL%.git}"
+ fi
+
+ SEARXNG_URL="$(python "${REPO_ROOT}/utils/get_setting.py" server.base_url)"
+ SEARXNG_PORT="$(python "${REPO_ROOT}/utils/get_setting.py" server.port)"
+ SEARXNG_BIND_ADDRESS="$(python "${REPO_ROOT}/utils/get_setting.py" server.bind_address)"
+ export GIT_URL
+ export GIT_BRANCH
+ export SEARXNG_URL
+ export SEARXNG_PORT
+ export SEARXNG_BIND_ADDRESS
+
+}
+
+pushd "${REPO_ROOT}" &> /dev/null
+build.env.export
+popd &> /dev/null