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

View File

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

View File

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

View File

@ -34,4 +34,6 @@ const (
DefaultFIFODir = "/run/containerd/fifo" DefaultFIFODir = "/run/containerd/fifo"
// DefaultRuntime is the default linux runtime // DefaultRuntime is the default linux runtime
DefaultRuntime = "io.containerd.runc.v2" 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 // DefaultStateDir is the default location used by containerd to store
// transient data // transient data
DefaultStateDir = filepath.Join(os.Getenv("ProgramData"), "containerd", "state") DefaultStateDir = filepath.Join(os.Getenv("ProgramData"), "containerd", "state")
// DefaultConfigDir is the default location for config files.
DefaultConfigDir = filepath.Join(os.Getenv("programfiles"), "containerd")
) )
const ( const (