mirror of
https://github.com/zix99/traefik-lazyload.git
synced 2025-12-25 06:49:14 +01:00
Some config and display tweaks
This commit is contained in:
@@ -15,17 +15,17 @@
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Last Active</th>
|
||||
<th>Stop Delay</th>
|
||||
<th>Rx</th>
|
||||
<th>Tx</th>
|
||||
<th>Stop Delay</th>
|
||||
</tr>
|
||||
{{range $val := .Active}}
|
||||
<tr>
|
||||
<td>{{$val.Name}}</td>
|
||||
<td>{{$val.LastActive.Format "2006-01-02 15:04:05"}}</td>
|
||||
<td>{{$val.LastActiveAge}}</td>
|
||||
<td>{{$val.StopDelay}}</td>
|
||||
<td>{{$val.Rx}}</td>
|
||||
<td>{{$val.Tx}}</td>
|
||||
<td>{{$val.StopDelay}}</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</table>
|
||||
|
||||
@@ -8,5 +8,4 @@ pollfreq: 10s
|
||||
statushost: ""
|
||||
verbose: false
|
||||
|
||||
labels:
|
||||
prefix: lazyloader
|
||||
labelprefix: lazyloader
|
||||
@@ -22,9 +22,7 @@ type ConfigModel struct {
|
||||
|
||||
Verbose bool // Debug-level logging
|
||||
|
||||
Labels struct {
|
||||
Prefix string `mapstructure:"prefix"`
|
||||
} `mapstructure:"labels"`
|
||||
LabelPrefix string
|
||||
}
|
||||
|
||||
var Model *ConfigModel = new(ConfigModel)
|
||||
@@ -48,5 +46,5 @@ func init() {
|
||||
}
|
||||
|
||||
func SubLabel(name string) string {
|
||||
return Model.Labels.Prefix + "." + name
|
||||
return Model.LabelPrefix + "." + name
|
||||
}
|
||||
|
||||
@@ -62,6 +62,10 @@ func (s *ContainerState) LastActive() time.Time {
|
||||
return s.lastActivity
|
||||
}
|
||||
|
||||
func (s *ContainerState) LastActiveAge() string {
|
||||
return time.Since(s.lastActivity).Round(time.Second).String()
|
||||
}
|
||||
|
||||
func (s *ContainerState) Rx() int64 {
|
||||
return s.lastRecv
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ func (s *Core) findContainerByHostname(ctx context.Context, hostname string) (*t
|
||||
// Finds all containers on node that are labeled with lazyloader config
|
||||
func (s *Core) findAllLazyloadContainers(ctx context.Context, includeStopped bool) ([]types.Container, error) {
|
||||
filters := filters.NewArgs()
|
||||
filters.Add("label", config.Model.Labels.Prefix)
|
||||
filters.Add("label", config.Model.LabelPrefix)
|
||||
|
||||
return s.client.ContainerList(ctx, types.ContainerListOptions{
|
||||
All: includeStopped,
|
||||
|
||||
Reference in New Issue
Block a user