aboutsummaryrefslogtreecommitdiff
path: root/pkg/domain/entities/engine.go
blob: 8553f53264de691d8a76d4e06160b81d69071eb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package entities

import (
	"os/user"
	"path/filepath"

	"github.com/containers/libpod/libpod/define"
	"github.com/spf13/pflag"
)

type EngineMode string

const (
	ABIMode    = EngineMode("abi")
	TunnelMode = EngineMode("tunnel")
)

func (m EngineMode) String() string {
	return string(m)
}

type EngineOptions struct {
	Uri        string
	Identities []string
	FlagSet    *pflag.FlagSet
	EngineMode EngineMode

	CGroupManager     string
	CniConfigDir      string
	ConmonPath        string
	DefaultMountsFile string
	EventsBackend     string
	HooksDir          []string
	MaxWorks          int
	Namespace         string
	Root              string
	Runroot           string
	Runtime           string
	StorageDriver     string
	StorageOpts       []string
	Syslog            bool
	Trace             bool
	NetworkCmdPath    string

	Config     string
	CpuProfile string
	LogLevel   string
	TmpDir     string

	RemoteUserName       string
	RemoteHost           string
	VarlinkAddress       string
	ConnectionName       string
	RemoteConfigFilePath string
	Port                 int
	IdentityFile         string
	IgnoreHosts          bool
}

func NewEngineOptions() (EngineOptions, error) {
	u, _ := user.Current()
	return EngineOptions{
		CGroupManager:        define.SystemdCgroupsManager,
		CniConfigDir:         "",
		Config:               "",
		ConmonPath:           filepath.Join("usr", "bin", "conmon"),
		ConnectionName:       "",
		CpuProfile:           "",
		DefaultMountsFile:    "",
		EventsBackend:        "",
		HooksDir:             nil,
		IdentityFile:         "",
		IgnoreHosts:          false,
		LogLevel:             "",
		MaxWorks:             0,
		Namespace:            "",
		NetworkCmdPath:       "",
		Port:                 0,
		RemoteConfigFilePath: "",
		RemoteHost:           "",
		RemoteUserName:       "",
		Root:                 "",
		Runroot:              filepath.Join("run", "user", u.Uid),
		Runtime:              "",
		StorageDriver:        "overlayfs",
		StorageOpts:          nil,
		Syslog:               false,
		TmpDir:               filepath.Join("run", "user", u.Uid, "libpod", "tmp"),
		Trace:                false,
		VarlinkAddress:       "",
	}, nil
}