be compatible with container.network_mode
This commit is contained in:
parent
7b04be5065
commit
f68a560b32
2 changed files with 10 additions and 2 deletions
internal/pkg/config
|
@ -45,7 +45,7 @@ container:
|
|||
# Specifies the network to which the container will connect.
|
||||
# Could be host, bridge or the name of a custom network.
|
||||
# If it's empty, act_runner will create a network automatically.
|
||||
network:
|
||||
network: ""
|
||||
# Whether to use privileged mode or not when launching task containers (privileged mode is required for Docker-in-Docker).
|
||||
privileged: false
|
||||
# And other options to be used when the container is started (eg, --add-host=my.gitea.url:host-gateway).
|
||||
|
|
|
@ -34,8 +34,8 @@ type Config struct {
|
|||
Port uint16 `yaml:"port"`
|
||||
} `yaml:"cache"`
|
||||
Container struct {
|
||||
// NetworkMode string `yaml:"network_mode"` // Legacy
|
||||
Network string `yaml:"network"`
|
||||
NetworkMode string `yaml:"network_mode"` // leagcy, but will be abandoned in future, be replace by network.
|
||||
Privileged bool `yaml:"privileged"`
|
||||
Options string `yaml:"options"`
|
||||
WorkdirParent string `yaml:"workdir_parent"`
|
||||
|
@ -103,5 +103,13 @@ func LoadDefault(file string) (*Config, error) {
|
|||
cfg.Runner.FetchInterval = 2 * time.Second
|
||||
}
|
||||
|
||||
// although `container.network_mode` will be abandoned,
|
||||
// but we have to be compatible with it for now.
|
||||
// rule: if the value of `container.network` is blank and the value of `container.network_mode` is not blank,
|
||||
// then the value of `container.network` will be set to the value of `container.network_mode`.
|
||||
if cfg.Container.Network == "" && cfg.Container.NetworkMode != "" {
|
||||
cfg.Container.Network = cfg.Container.NetworkMode
|
||||
}
|
||||
|
||||
return cfg, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue