Files
moby/daemon/libnetwork/config/config_linux.go
Albin Kerouanton 2436458227 libnet/d/bridge: Register: pass a Configuration struct
Libnetwork passes a map[string]any to the bridge driver's Register
function. This forces the daemon to convert its configuration into a
map, and the driver to convert that map back into a struct.

This is unnecessary complexity, and makes it harder to track down where
and how bridge driver configuration fields are set.

Refactor libnetwork to let the daemon register the bridge.Configuration
directly through a new option `OptionBridgeConfig`.

The bridge driver now takes a `Configuration` param that needs no
special treatment.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 12:10:10 +02:00

27 lines
666 B
Go

package config
import (
"github.com/moby/moby/v2/daemon/libnetwork/drivers/bridge"
"github.com/moby/moby/v2/daemon/libnetwork/osl"
)
// PlatformConfig defines platform-specific configuration.
type PlatformConfig struct {
BridgeConfig bridge.Configuration
}
// OptionBridgeConfig returns an option setter for bridge driver config.
func OptionBridgeConfig(config bridge.Configuration) Option {
return func(c *Config) {
c.BridgeConfig = config
}
}
// optionExecRoot on Linux sets both the controller's ExecRoot and osl.basePath.
func optionExecRoot(execRoot string) Option {
return func(c *Config) {
c.ExecRoot = execRoot
osl.SetBasePath(execRoot)
}
}