mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-22 00:08:11 +00:00
Export config.GetDefault function
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
e4722e9642
commit
8bf52e1dec
@ -81,12 +81,12 @@ func GetConfig() (*Config, error) {
|
||||
// Load loads the config from the specified file path.
|
||||
func Load(configFilePath string) (*Config, error) {
|
||||
if configFilePath == "" {
|
||||
return getDefault()
|
||||
return GetDefault()
|
||||
}
|
||||
|
||||
tomlFile, err := os.Open(configFilePath)
|
||||
if err != nil {
|
||||
return getDefault()
|
||||
return GetDefault()
|
||||
}
|
||||
defer tomlFile.Close()
|
||||
|
||||
@ -114,7 +114,7 @@ func LoadFrom(reader io.Reader) (*Config, error) {
|
||||
|
||||
// getFromTree reads the nvidia container runtime config from the specified toml Tree.
|
||||
func getFromTree(toml *toml.Tree) (*Config, error) {
|
||||
cfg, err := getDefault()
|
||||
cfg, err := GetDefault()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -129,8 +129,8 @@ func getFromTree(toml *toml.Tree) (*Config, error) {
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
// getDefault defines the default values for the config
|
||||
func getDefault() (*Config, error) {
|
||||
// GetDefault defines the default values for the config
|
||||
func GetDefault() (*Config, error) {
|
||||
d := Config{
|
||||
AcceptEnvvarUnprivileged: true,
|
||||
NVIDIAContainerCLIConfig: ContainerCLIConfig{
|
||||
|
@ -237,7 +237,7 @@ func TestGetConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConfigDefault(t *testing.T) {
|
||||
config, err := getDefault()
|
||||
config, err := GetDefault()
|
||||
require.NoError(t, err)
|
||||
|
||||
buffer := new(bytes.Buffer)
|
||||
|
@ -27,7 +27,7 @@ type RuntimeHookConfig struct {
|
||||
|
||||
// GetDefaultRuntimeHookConfig defines the default values for the config
|
||||
func GetDefaultRuntimeHookConfig() (*RuntimeHookConfig, error) {
|
||||
cfg, err := getDefault()
|
||||
cfg, err := GetDefault()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ type csvModeConfig struct {
|
||||
|
||||
// GetDefaultRuntimeConfig defines the default values for the config
|
||||
func GetDefaultRuntimeConfig() (*RuntimeConfig, error) {
|
||||
cfg, err := getDefault()
|
||||
cfg, err := GetDefault()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user