Fix transfer plugin unpack configuration
Remove default unpack configuration to prevent duplication of configuration from toml decoder appending to the default. When no unpack configuration is provided, use the default. Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
parent
02e0fef84b
commit
cf6f439eb0
@ -77,6 +77,17 @@ func init() {
|
|||||||
var lc local.TransferConfig
|
var lc local.TransferConfig
|
||||||
lc.MaxConcurrentDownloads = config.MaxConcurrentDownloads
|
lc.MaxConcurrentDownloads = config.MaxConcurrentDownloads
|
||||||
lc.MaxConcurrentUploadedLayers = config.MaxConcurrentUploadedLayers
|
lc.MaxConcurrentUploadedLayers = config.MaxConcurrentUploadedLayers
|
||||||
|
|
||||||
|
// If UnpackConfiguration is not defined, set the default.
|
||||||
|
// If UnpackConfiguration is defined and empty, ignore.
|
||||||
|
if config.UnpackConfiguration == nil {
|
||||||
|
config.UnpackConfiguration = []unpackConfiguration{
|
||||||
|
{
|
||||||
|
Platform: platforms.Format(platforms.DefaultSpec()),
|
||||||
|
Snapshotter: defaults.DefaultSnapshotter,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
for _, uc := range config.UnpackConfiguration {
|
for _, uc := range config.UnpackConfiguration {
|
||||||
p, err := platforms.Parse(uc.Platform)
|
p, err := platforms.Parse(uc.Platform)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -148,7 +159,7 @@ type transferConfig struct {
|
|||||||
MaxConcurrentUploadedLayers int `toml:"max_concurrent_uploaded_layers"`
|
MaxConcurrentUploadedLayers int `toml:"max_concurrent_uploaded_layers"`
|
||||||
|
|
||||||
// UnpackConfiguration is used to read config from toml
|
// UnpackConfiguration is used to read config from toml
|
||||||
UnpackConfiguration []unpackConfiguration `toml:"unpack_config"`
|
UnpackConfiguration []unpackConfiguration `toml:"unpack_config,omitempty"`
|
||||||
|
|
||||||
// RegistryConfigPath is a path to the root directory containing registry-specific configurations
|
// RegistryConfigPath is a path to the root directory containing registry-specific configurations
|
||||||
RegistryConfigPath string `toml:"config_path"`
|
RegistryConfigPath string `toml:"config_path"`
|
||||||
@ -169,11 +180,5 @@ func defaultConfig() *transferConfig {
|
|||||||
return &transferConfig{
|
return &transferConfig{
|
||||||
MaxConcurrentDownloads: 3,
|
MaxConcurrentDownloads: 3,
|
||||||
MaxConcurrentUploadedLayers: 3,
|
MaxConcurrentUploadedLayers: 3,
|
||||||
UnpackConfiguration: []unpackConfiguration{
|
|
||||||
{
|
|
||||||
Platform: platforms.Format(platforms.DefaultSpec()),
|
|
||||||
Snapshotter: defaults.DefaultSnapshotter,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user