run 690 Bytes
Newer Older
1 2
#!/bin/sh

3
# TODO rewrite config parsing in lib/run.rb
4

5 6 7 8 9 10 11 12 13 14
main() {
  # Try to read the gitlab-workhorse host:port from the environments
  if [ "x${host}" = x ]; then
    # Try a host file
    host="$(cat host 2>/dev/null)"
  fi
  if [ "x${port}" = x ]; then
    # Try a port file
    port="$(cat port 2>/dev/null)"
  fi
15 16 17 18
  if [ "x${relative_url_root}" = x ]; then
    # Try a relative_url_root file
    relative_url_root="$(cat relative_url_root 2>/dev/null)"
  fi
19 20 21 22

  # Fall back to localhost:3000
  host="${host:-localhost}"
  port="${port:-3000}"
23
  relative_url_root="${relative_url_root:-/}"
24

25 26 27 28 29
  export host
  export port
  export relative_url_root

  exec ruby lib/run.rb "$@"
30
}
31 32

main "$@"