brand.sh 965 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env bash
  2. # SPDX-License-Identifier: AGPL-3.0-or-later
  3. # shellcheck source=utils/lib.sh
  4. . /dev/null
  5. build.env.export() {
  6. GIT_BRANCH="$(git branch | grep '\*' | cut -d' ' -f2-)"
  7. GIT_REMOTE="$(git config "branch.${GIT_BRANCH}.remote")"
  8. GIT_URL="$(git config --get "remote.${GIT_REMOTE}.url")"
  9. if [[ "${GIT_URL}" == git@* ]]; then
  10. GIT_URL="${GIT_URL/://}"
  11. GIT_URL="${GIT_URL/git@/https://}"
  12. fi
  13. if [[ "${GIT_URL}" == *.git ]]; then
  14. GIT_URL="${GIT_URL%.git}"
  15. fi
  16. SEARXNG_URL="$(python "${REPO_ROOT}/utils/get_setting.py" server.base_url)"
  17. SEARXNG_PORT="$(python "${REPO_ROOT}/utils/get_setting.py" server.port)"
  18. SEARXNG_BIND_ADDRESS="$(python "${REPO_ROOT}/utils/get_setting.py" server.bind_address)"
  19. export GIT_URL
  20. export GIT_BRANCH
  21. export SEARXNG_URL
  22. export SEARXNG_PORT
  23. export SEARXNG_BIND_ADDRESS
  24. }
  25. pushd "${REPO_ROOT}" &> /dev/null
  26. build.env.export
  27. popd &> /dev/null