mirror of
https://github.com/traefik/traefik.git
synced 2025-09-26 16:21:15 +02:00
fix: add filename in the file provider logs.
This commit is contained in:
parent
17ce295c30
commit
e7b7ae94b0
@ -539,7 +539,7 @@ The `address` option (IP:Port) point to a specific instance.
|
|||||||
my-service:
|
my-service:
|
||||||
loadBalancer:
|
loadBalancer:
|
||||||
servers:
|
servers:
|
||||||
address: "xx.xx.xx.xx:xx"
|
- address: "xx.xx.xx.xx:xx"
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Termination Delay
|
#### Termination Delay
|
||||||
|
@ -199,8 +199,6 @@ func flattenCertificates(ctx context.Context, tlsConfig *dynamic.TLSConfiguratio
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *Provider) loadFileConfigFromDirectory(ctx context.Context, directory string, configuration *dynamic.Configuration) (*dynamic.Configuration, error) {
|
func (p *Provider) loadFileConfigFromDirectory(ctx context.Context, directory string, configuration *dynamic.Configuration) (*dynamic.Configuration, error) {
|
||||||
logger := log.FromContext(ctx)
|
|
||||||
|
|
||||||
fileList, err := ioutil.ReadDir(directory)
|
fileList, err := ioutil.ReadDir(directory)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return configuration, fmt.Errorf("unable to read directory %s: %v", directory, err)
|
return configuration, fmt.Errorf("unable to read directory %s: %v", directory, err)
|
||||||
@ -227,6 +225,8 @@ func (p *Provider) loadFileConfigFromDirectory(ctx context.Context, directory st
|
|||||||
configTLSMaps := make(map[*tls.CertAndStores]struct{})
|
configTLSMaps := make(map[*tls.CertAndStores]struct{})
|
||||||
|
|
||||||
for _, item := range fileList {
|
for _, item := range fileList {
|
||||||
|
logger := log.FromContext(log.With(ctx, log.Str("filename", item.Name())))
|
||||||
|
|
||||||
if item.IsDir() {
|
if item.IsDir() {
|
||||||
configuration, err = p.loadFileConfigFromDirectory(ctx, filepath.Join(directory, item.Name()), configuration)
|
configuration, err = p.loadFileConfigFromDirectory(ctx, filepath.Join(directory, item.Name()), configuration)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -245,7 +245,7 @@ func (p *Provider) loadFileConfigFromDirectory(ctx context.Context, directory st
|
|||||||
var c *dynamic.Configuration
|
var c *dynamic.Configuration
|
||||||
c, err = p.loadFileConfig(ctx, filepath.Join(directory, item.Name()), true)
|
c, err = p.loadFileConfig(ctx, filepath.Join(directory, item.Name()), true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return configuration, err
|
return configuration, fmt.Errorf("%s: %v", filepath.Join(directory, item.Name()), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, conf := range c.HTTP.Routers {
|
for name, conf := range c.HTTP.Routers {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user