Skip to content

Commit

Permalink
Renaming pricing config to config fetcher name its purpose
Browse files Browse the repository at this point in the history
  • Loading branch information
rajagopal28 committed Jul 30, 2021
1 parent 11d6ce4 commit 3c328ca
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,23 @@ import (
"log"
)

type Config struct{}
type ConfigFetcher struct{
Path string
}


func (a *Config) ReadFileAndGetAsObject(path string, class interface{}) (interface{}, error) {
func (c *ConfigFetcher) ReadFileAndGetAsObject(filename string, class interface{}) (interface{}, error) {
pwd, _ := os.Getwd()
log.Print("Current Working Directory: ", pwd)
jsonFile, err := os.Open(pwd+path)
jsonFile, err := os.Open(pwd+c.Path+filename)
// txt, _ := ioutil.ReadFile(pwd+"/path/to/file.txt")
// if we os.Open returns an error then handle it

if err != nil {
log.Fatalf("error opening file: %v", err)
return nil, err
}
log.Print("Successfully Opened ", path)
log.Print("Successfully Opened ", filename)
// defer the closing of our jsonFile so that we can parse it later on
defer jsonFile.Close()
byteValue, _ := ioutil.ReadAll(jsonFile)
Expand Down

0 comments on commit 3c328ca

Please sign in to comment.