diff --git a/bbgoget.go b/bbgoget.go index abb6096..e3aaeff 100644 --- a/bbgoget.go +++ b/bbgoget.go @@ -21,7 +21,7 @@ func main() { fs.StringVar(&listenAddr, "listen-address", ":8800", "specify listen address") fs.IntVar(&sshPort, "ssh-port", 7999, "specify bitbucket ssh port") - fs.StringVar(&serverNameOverride, "servername-override", "", "override the server name. if not specified, uses the host value from the request url") + fs.StringVar(&serverNameOverride, "servername-override", "", "override the server name. if not specified, uses the host value from the X-Forwarded-Host header") _ = fs.Parse(os.Args[1:]) @@ -72,7 +72,7 @@ func (bbh *BBHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request) { return } - prefix := strings.Join(pathParts[0:3], "/") + prefix := strings.Join(pathParts[:3], "/") host := bbh.serverNameOverride if len(host) == 0 { if len(host) == 0 { diff --git a/bbgoget.service b/bbgoget.service new file mode 100644 index 0000000..c898015 --- /dev/null +++ b/bbgoget.service @@ -0,0 +1,16 @@ +[Unit] +Description=bbgoget server +Requires=network-online.target +After=network-online.target + +[Service] +User=bbgoget +Group=bbgoget +LimitNOFILE=65536 +EnvironmentFile=-/etc/sysconfig/bbgoget +Restart=on-failure +ExecStart=/usr/bin/bbgoget $OPTIONS +KillSignal=SIGINT + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/bbgoget.sysconfig b/bbgoget.sysconfig new file mode 100644 index 0000000..6a49c7f --- /dev/null +++ b/bbgoget.sysconfig @@ -0,0 +1,2 @@ + +# OPTIONS="-listen-address :8080 -servername-override bitbucket.myorg.net -ssh-port 7999" \ No newline at end of file