Skip to content

Commit

Permalink
ignore errors when opening one_auth file
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Willis <[email protected]>
  • Loading branch information
peterwillis committed May 31, 2024
1 parent c53e485 commit 9c30eb5
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/oca/go/src/goca/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,19 @@ func NewConfig(user, password, endpoint string) OneConfig {
oneAuthPath = os.Getenv("HOME") + "/.one/one_auth"
}

file, err := os.Open(oneAuthPath)
if err != nil {
log.Fatalln(err)
}
defer file.Close()
file, _ := os.Open(oneAuthPath)
if file != nil {
defer file.Close()

scanner := bufio.NewScanner(file)
scanner := bufio.NewScanner(file)

scanner.Scan()
if scanner.Err() != nil {
log.Fatalln(scanner.Err())
}
scanner.Scan()
if scanner.Err() != nil {
log.Fatalln(scanner.Err())
}

conf.Token = scanner.Text()
conf.Token = scanner.Text()
}
} else {
conf.Token = user + ":" + password
}
Expand Down

0 comments on commit 9c30eb5

Please sign in to comment.