Add listen directive

This provides a multi-line way to list addresses.
This commit is contained in:
Simon Ser 2022-06-25 11:43:16 +02:00
parent 826cbd7fe1
commit d1812162a8
2 changed files with 9 additions and 1 deletions

View File

@ -59,7 +59,12 @@ func parseFrontend(srv *Server, d *scfg.Directive) error {
frontend.Protocols = protocolDirective.Params
}
for _, addr := range d.Params {
addresses := append([]string(nil), d.Params...)
for _, listenDirective := range d.Children.GetAll("listen") {
addresses = append(addresses, listenDirective.Params...)
}
for _, addr := range addresses {
host, port, err := net.SplitHostPort(addr)
if err != nil {
return fmt.Errorf("failed to parse frontend address %q: %v", addr, err)

View File

@ -49,6 +49,9 @@ The following directives are supported:
The frontend directive supports the following sub-directives:
*listen* <address>...
Additional addresses to listen on.
*backend* <uri>...
Backend to forward incoming connections to.