defaults: add DefaultConfigDir

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda 2021-03-08 17:37:58 +09:00
parent e231b955dd
commit 9a7ca39cbd
No known key found for this signature in database
GPG Key ID: 49524C6F9F638F1A
5 changed files with 8 additions and 6 deletions

View File

@ -27,6 +27,7 @@ import (
"runtime"
"time"
"github.com/containerd/containerd/defaults"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/mount"
@ -80,7 +81,7 @@ can be used and modified as necessary as a custom configuration.`
cli.StringFlag{
Name: "config,c",
Usage: "path to the configuration file",
Value: defaultConfigPath,
Value: filepath.Join(defaults.DefaultConfigDir, "config.toml"),
},
cli.StringFlag{
Name: "log-level,l",

View File

@ -27,8 +27,6 @@ import (
"golang.org/x/sys/unix"
)
const defaultConfigPath = "/etc/containerd/config.toml"
var handledSignals = []os.Signal{
unix.SIGTERM,
unix.SIGINT,

View File

@ -20,7 +20,6 @@ import (
"context"
"fmt"
"os"
"path/filepath"
"unsafe"
"github.com/Microsoft/go-winio/pkg/etw"
@ -33,8 +32,7 @@ import (
)
var (
defaultConfigPath = filepath.Join(os.Getenv("programfiles"), "containerd", "config.toml")
handledSignals = []os.Signal{
handledSignals = []os.Signal{
windows.SIGTERM,
windows.SIGINT,
}

View File

@ -34,4 +34,6 @@ const (
DefaultFIFODir = "/run/containerd/fifo"
// DefaultRuntime is the default linux runtime
DefaultRuntime = "io.containerd.runc.v2"
// DefaultConfigDir is the default location for config files.
DefaultConfigDir = "/etc/containerd"
)

View File

@ -30,6 +30,9 @@ var (
// DefaultStateDir is the default location used by containerd to store
// transient data
DefaultStateDir = filepath.Join(os.Getenv("ProgramData"), "containerd", "state")
// DefaultConfigDir is the default location for config files.
DefaultConfigDir = filepath.Join(os.Getenv("programfiles"), "containerd")
)
const (