Skip to content

Commit

Permalink
Add function to create configuration from fullpath defined file
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-yves FONTANIERE committed Sep 16, 2024
1 parent 613aa25 commit f6a8165
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions ov/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,9 @@ type ServerProfileConfig struct {
OvTemplatestring string `json:"ov_template"`
}

func LoadConfigFile(configFile string) (Configuration, error) {
_, filename, _, _ := runtime.Caller(1)
configFilePath := filepath.Join(filepath.Dir(filename), configFile)
func LoadConfigFilePath(configFilePath string) (Configuration, error) {
configF, err := os.Open(configFilePath)

var config Configuration
defer configF.Close()
if err != nil {
Expand All @@ -114,4 +113,12 @@ func LoadConfigFile(configFile string) (Configuration, error) {
}

return config, nil

}

func LoadConfigFile(configFile string) (Configuration, error) {
_, filename, _, _ := runtime.Caller(1)
configFilePath := filepath.Join(filepath.Dir(filename), configFile)

return LoadConfigFilePath(configFilePath)
}

0 comments on commit f6a8165

Please sign in to comment.