github.com/containerd/nerdctl@v1.7.7/pkg/config/config.go (about)

     1  /*
     2     Copyright The containerd Authors.
     3  
     4     Licensed under the Apache License, Version 2.0 (the "License");
     5     you may not use this file except in compliance with the License.
     6     You may obtain a copy of the License at
     7  
     8         http://www.apache.org/licenses/LICENSE-2.0
     9  
    10     Unless required by applicable law or agreed to in writing, software
    11     distributed under the License is distributed on an "AS IS" BASIS,
    12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     See the License for the specific language governing permissions and
    14     limitations under the License.
    15  */
    16  
    17  package config
    18  
    19  import (
    20  	"github.com/containerd/containerd"
    21  	"github.com/containerd/containerd/defaults"
    22  	"github.com/containerd/containerd/namespaces"
    23  	ncdefaults "github.com/containerd/nerdctl/pkg/defaults"
    24  )
    25  
    26  // Config corresponds to nerdctl.toml .
    27  // See docs/config.md .
    28  type Config struct {
    29  	Debug            bool     `toml:"debug"`
    30  	DebugFull        bool     `toml:"debug_full"`
    31  	Address          string   `toml:"address"`
    32  	Namespace        string   `toml:"namespace"`
    33  	Snapshotter      string   `toml:"snapshotter"`
    34  	CNIPath          string   `toml:"cni_path"`
    35  	CNINetConfPath   string   `toml:"cni_netconfpath"`
    36  	DataRoot         string   `toml:"data_root"`
    37  	CgroupManager    string   `toml:"cgroup_manager"`
    38  	InsecureRegistry bool     `toml:"insecure_registry"`
    39  	HostsDir         []string `toml:"hosts_dir"`
    40  	Experimental     bool     `toml:"experimental"`
    41  	HostGatewayIP    string   `toml:"host_gateway_ip"`
    42  }
    43  
    44  // New creates a default Config object statically,
    45  // without interpolating CLI flags, env vars, and toml.
    46  func New() *Config {
    47  	return &Config{
    48  		Debug:            false,
    49  		DebugFull:        false,
    50  		Address:          defaults.DefaultAddress,
    51  		Namespace:        namespaces.Default,
    52  		Snapshotter:      containerd.DefaultSnapshotter,
    53  		CNIPath:          ncdefaults.CNIPath(),
    54  		CNINetConfPath:   ncdefaults.CNINetConfPath(),
    55  		DataRoot:         ncdefaults.DataRoot(),
    56  		CgroupManager:    ncdefaults.CgroupManager(),
    57  		InsecureRegistry: false,
    58  		HostsDir:         ncdefaults.HostsDirs(),
    59  		Experimental:     true,
    60  		HostGatewayIP:    ncdefaults.HostGatewayIP(),
    61  	}
    62  }