mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-03 17:43:49 +03:00
core: Simplify Server initializer
This commit is contained in:
parent
3c36edec1f
commit
1a82943db2
2 changed files with 7 additions and 2 deletions
2
main.go
2
main.go
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue