mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-02 22:56:30 +00:00
25 lines
650 B
Go
25 lines
650 B
Go
|
package script
|
||
|
|
||
|
const (
|
||
|
DefaultDockerNetworkMode = "bridge"
|
||
|
)
|
||
|
|
||
|
// Docker stores the configuration details for
|
||
|
// configuring docker container.
|
||
|
type Docker struct {
|
||
|
// NetworkMode (also known as `--net` option)
|
||
|
// Could be set only if Docker is running in privileged mode
|
||
|
NetworkMode *string `yaml:"net,omitempty"`
|
||
|
}
|
||
|
|
||
|
// DockerNetworkMode returns DefaultNetworkMode
|
||
|
// when Docker.NetworkMode is empty.
|
||
|
// DockerNetworkMode returns Docker.NetworkMode
|
||
|
// when it is not empty.
|
||
|
func DockerNetworkMode(d *Docker) string {
|
||
|
if d == nil || d.NetworkMode == nil {
|
||
|
return DefaultDockerNetworkMode
|
||
|
}
|
||
|
return *d.NetworkMode
|
||
|
}
|