File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package netserver
2
2
3
3
import (
4
4
"fmt"
5
+ "log"
5
6
"strings"
6
7
7
8
"github.com/mholt/caddy"
@@ -113,7 +114,10 @@ func (n *netContext) InspectServerBlocks(sourceFile string, serverBlocks []caddy
113
114
114
115
// Make our caddytls.Config, which has a pointer to the
115
116
// instance's certificate cache
116
- caddytlsConfig := caddytls .NewConfig (n .instance )
117
+ caddytlsConfig , err := caddytls .NewConfig (n .instance )
118
+ if err != nil {
119
+ return serverBlocks , fmt .Errorf ("creating new TLS configuration: %v" , err )
120
+ }
117
121
118
122
// Save the config to our master list, and key it for lookups
119
123
c := & Config {
@@ -174,7 +178,11 @@ func GetConfig(c *caddy.Controller) *Config {
174
178
// is not echo or proxy i.e port number :12017
175
179
// we can't return a nil because caddytls.RegisterConfigGetter will panic
176
180
// so we return a default (blank) config value
177
- caddytlsConfig := caddytls .NewConfig (ctx .instance )
181
+ caddytlsConfig , err := caddytls .NewConfig (ctx .instance )
182
+ if err != nil {
183
+ log .Printf ("[ERROR] Making new TLS configuration: %v" , err )
184
+ return new (Config )
185
+ }
178
186
179
187
return & Config {TLS : caddytlsConfig }
180
188
}
You can’t perform that action at this time.
0 commit comments