check if defaultcertificate is defined in store
This commit is contained in:
parent
2a2f7f783f
commit
8d4620dc53
3 changed files with 14 additions and 0 deletions
|
@ -191,6 +191,10 @@ func (p *Provider) loadFileConfig(ctx context.Context, filename string, parseTem
|
||||||
// TLS stores
|
// TLS stores
|
||||||
if len(configuration.TLS.Stores) > 0 {
|
if len(configuration.TLS.Stores) > 0 {
|
||||||
for name, store := range configuration.TLS.Stores {
|
for name, store := range configuration.TLS.Stores {
|
||||||
|
if store.DefaultCertificate == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
content, err := store.DefaultCertificate.CertFile.Read()
|
content, err := store.DefaultCertificate.CertFile.Read()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.FromContext(ctx).Error(err)
|
log.FromContext(ctx).Error(err)
|
||||||
|
|
|
@ -262,6 +262,13 @@ func getTestCases() []ProvideTestCase {
|
||||||
expectedNumRouter: 20,
|
expectedNumRouter: 20,
|
||||||
expectedNumService: 20,
|
expectedNumService: 20,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
desc: "simple file with empty store yaml",
|
||||||
|
filePath: "./fixtures/yaml/simple_empty_store.yml",
|
||||||
|
expectedNumRouter: 0,
|
||||||
|
expectedNumService: 0,
|
||||||
|
expectedNumTLSConf: 0,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
3
pkg/provider/file/fixtures/yaml/simple_empty_store.yml
Normal file
3
pkg/provider/file/fixtures/yaml/simple_empty_store.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
tls:
|
||||||
|
stores:
|
||||||
|
default: {}
|
Loading…
Reference in a new issue