Commit 1a82943d authored by Matthew Holt's avatar Matthew Holt

core: Simplify Server initializer

parent 3c36edec
......@@ -63,7 +63,7 @@ func main() {
// Start each server with its one or more configurations
for addr, configs := range addresses {
s, err := server.New(addr.String(), configs, configs[0].TLS.Enabled)
s, err := server.New(addr.String(), configs)
if err != nil {
log.Fatal(err)
}
......
......@@ -29,7 +29,12 @@ type Server struct {
// New creates a new Server which will bind to addr and serve
// the sites/hosts configured in configs. This function does
// not start serving.
func New(addr string, configs []Config, tls bool) (*Server, error) {
func New(addr string, configs []Config) (*Server, error) {
var tls bool
if len(configs) > 0 {
tls = configs[0].TLS.Enabled
}
s := &Server{
address: addr,
tls: tls,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment