core: Simplify Server initializer

This commit is contained in:
Matthew Holt 2015-07-11 12:00:11 -06:00
parent 3c36edec1f
commit 1a82943db2
2 changed files with 7 additions and 2 deletions

View file

@ -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)
}

View file

@ -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,