Export config.GetDefault function

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2023-08-10 12:20:07 +02:00
parent e4722e9642
commit 8bf52e1dec
4 changed files with 8 additions and 8 deletions

View File

@ -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{

View File

@ -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)

View File

@ -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
}

View File

@ -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
}