mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 04:42:25 -05:00
add bindAddress configuration option (#320)
* add bindAddress configuration option * clarify that bindAddress can be a hostname
This commit is contained in:
parent
6c0550e76f
commit
1ded58b34b
6 changed files with 42 additions and 3 deletions
|
|
@ -72,7 +72,8 @@ func (r *router) Start() {
|
|||
if r.config.LetsEncryptConfig.Enabled {
|
||||
// serve the http handler on the selected letsencrypt port, for receiving letsencrypt requests and solving their devious riddles
|
||||
go func() {
|
||||
if err := http.ListenAndServe(fmt.Sprintf(":%d", r.config.LetsEncryptConfig.Port), r.certManager.HTTPHandler(http.HandlerFunc(httpsRedirect))); err != nil && err != http.ErrServerClosed {
|
||||
listen := fmt.Sprintf("%s:%d", r.config.BindAddress, r.config.LetsEncryptConfig.Port)
|
||||
if err := http.ListenAndServe(listen, r.certManager.HTTPHandler(http.HandlerFunc(httpsRedirect))); err != nil && err != http.ErrServerClosed {
|
||||
logrus.Fatalf("listen: %s", err)
|
||||
}
|
||||
}()
|
||||
|
|
@ -138,8 +139,9 @@ func New(ctx context.Context, cfg *config.Config, db db.DB) (Router, error) {
|
|||
}
|
||||
|
||||
// create the http server here, passing the gin engine as handler
|
||||
listen := fmt.Sprintf("%s:%d", cfg.BindAddress, cfg.Port)
|
||||
s := &http.Server{
|
||||
Addr: fmt.Sprintf(":%d", cfg.Port),
|
||||
Addr: listen,
|
||||
Handler: engine,
|
||||
ReadTimeout: readTimeout,
|
||||
WriteTimeout: writeTimeout,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue