mirror of
https://github.com/crazy-max/diun.git
synced 2025-12-31 18:17:24 +01:00
Global defaults for image configs
Allows setting of image configs at a global level to act as default values. This required a change in the model.Image struct due to a bool field not having a third, unset state. The remedy is to unmarshal into a temporary data structure to detect the presents of a field value and then use that to determine if the default value should be used. Fixes #491
This commit is contained in:
@@ -10,16 +10,18 @@ import (
|
||||
// Client represents an active swarm provider object
|
||||
type Client struct {
|
||||
*provider.Client
|
||||
config *model.PrdSwarm
|
||||
logger zerolog.Logger
|
||||
config *model.PrdSwarm
|
||||
logger zerolog.Logger
|
||||
imageDefaults *model.Image
|
||||
}
|
||||
|
||||
// New creates new swarm provider instance
|
||||
func New(config *model.PrdSwarm) *provider.Client {
|
||||
func New(config *model.PrdSwarm, imageDefaults *model.Image) *provider.Client {
|
||||
return &provider.Client{
|
||||
Handler: &Client{
|
||||
config: config,
|
||||
logger: log.With().Str("provider", "swarm").Logger(),
|
||||
config: config,
|
||||
logger: log.With().Str("provider", "swarm").Logger(),
|
||||
imageDefaults: imageDefaults,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user