mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-12-25 08:30:29 +00:00
[chore] Update LE server to use copy of main http.Server{} to maintain server timeouts etc (#571)
* update LE server to use copy of main HTTP server to maintain server timeouts etc Signed-off-by: kim <grufwub@gmail.com> * shutup linter Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
parent
9f2a2abe42
commit
4ac508f037
1 changed files with 8 additions and 4 deletions
|
@ -91,15 +91,19 @@ func (r *router) Start() {
|
||||||
http.Redirect(rw, r, target, http.StatusTemporaryRedirect)
|
http.Redirect(rw, r, target, http.StatusTemporaryRedirect)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Start the LetsEncrypt autocert manager HTTP server.
|
|
||||||
go func() {
|
go func() {
|
||||||
addr := fmt.Sprintf("%s:%d",
|
// Take our own copy of HTTP server
|
||||||
|
// with updated autocert manager endpoint
|
||||||
|
srv := (*r.srv) //nolint
|
||||||
|
srv.Handler = r.certManager.HTTPHandler(redirect)
|
||||||
|
srv.Addr = fmt.Sprintf("%s:%d",
|
||||||
viper.GetString(keys.BindAddress),
|
viper.GetString(keys.BindAddress),
|
||||||
viper.GetInt(keys.LetsEncryptPort),
|
viper.GetInt(keys.LetsEncryptPort),
|
||||||
)
|
)
|
||||||
|
|
||||||
logrus.Infof("letsencrypt listening on %s", addr)
|
// Start the LetsEncrypt autocert manager HTTP server.
|
||||||
if err := http.ListenAndServe(addr, r.certManager.HTTPHandler(redirect)); err != nil &&
|
logrus.Infof("letsencrypt listening on %s", srv.Addr)
|
||||||
|
if err := srv.ListenAndServe(); err != nil &&
|
||||||
err != http.ErrServerClosed {
|
err != http.ErrServerClosed {
|
||||||
logrus.Fatalf("letsencrypt: listen: %s", err)
|
logrus.Fatalf("letsencrypt: listen: %s", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue