Skip to content

Commit

Permalink
defaults: add DefaultConfigDir
Browse files Browse the repository at this point in the history
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
  • Loading branch information
AkihiroSuda committed Mar 15, 2021
1 parent e231b95 commit 9a7ca39
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion cmd/containerd/command/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions cmd/containerd/command/main_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import (
"golang.org/x/sys/unix"
)

const defaultConfigPath = "/etc/containerd/config.toml"

var handledSignals = []os.Signal{
unix.SIGTERM,
unix.SIGINT,
Expand Down
4 changes: 1 addition & 3 deletions cmd/containerd/command/main_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"context"
"fmt"
"os"
"path/filepath"
"unsafe"

"github.com/Microsoft/go-winio/pkg/etw"
Expand All @@ -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,
}
Expand Down
2 changes: 2 additions & 0 deletions defaults/defaults_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
3 changes: 3 additions & 0 deletions defaults/defaults_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit 9a7ca39

Please sign in to comment.