52 lines
976 B

  1. #!/bin/bash
  2. ## Load action gets a first argument a DIRECTORY holding the necessary files.
  3. ##
  4. ##
  5. if [ -z "$SERVICE_DATASTORE" ]; then
  6. echo "This script is meant to be run through 'compose' to work properly." >&2
  7. exit 1
  8. fi
  9. usage="$exname [-h|--help] KEYWORD"
  10. KEYWORD=
  11. while [ "$1" ]; do
  12. case "$1" in
  13. "--help"|"-h")
  14. print_usage
  15. exit 0
  16. ;;
  17. *)
  18. [ -z "$KEYWORD" ] && { KEYWORD=$1 ; shift ; continue ; }
  19. err "Unexpected argument '$1'."
  20. exit 1
  21. ;;
  22. esac
  23. shift
  24. done
  25. if [ -z "$KEYWORD" ]; then
  26. err "You must provide a keyword as first argument."
  27. print_usage
  28. exit 1
  29. fi
  30. . "$CHARM_PATH/lib/common"
  31. ## This can work only if ~/.pgpass is correctly created by init.
  32. case "$KEYWORD" in
  33. url)
  34. ini get server ROOT_URL || true
  35. ;;
  36. name)
  37. echo gitea
  38. ;;
  39. *)
  40. err "Unknown keyword $KEYWORD."
  41. exit 1
  42. ;;
  43. esac