Skip to content

Commit b163c86

Browse files
committed
fix(app): listen on default port if not specified
1 parent 12263f0 commit b163c86

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/app/main.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,18 @@ func NewApp(params []*param.Param) *App {
6565
}
6666
}
6767

68+
listens := p.Listens
69+
if len(listens) == 0 && len(p.ListensPlain) == 0 && len(p.ListensTLS) == 0 {
70+
if cert == nil {
71+
listens = []string{":80"}
72+
} else {
73+
listens = []string{":443"}
74+
}
75+
}
76+
6877
// init vhost
6978
errors = vhSvc.Add(&goVirtualHost.HostInfo{
70-
Listens: p.Listens,
79+
Listens: listens,
7180
ListensPlain: p.ListensPlain,
7281
ListensTLS: p.ListensTLS,
7382
Cert: cert,

0 commit comments

Comments
 (0)