Skip to content

Commit

Permalink
Merge pull request #6 from infamousjoeg/fix-5-remove-config
Browse files Browse the repository at this point in the history
Fix #5 - Logoff removes config file
  • Loading branch information
infamousjoeg authored Oct 5, 2020
2 parents 74b7963 + ea9de4f commit 6c197f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions cmd/logoff.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ var logoffCmd = &cobra.Command{
log.Fatalf("Failed to log off. %s", err)
return
}
// Remove the config file written to local file system
err = client.RemoveConfig()
if err != nil {
log.Fatalf("Failed to remove configuration file. %s", err)
}

fmt.Println("Successfully logged off PAS.")
},
Expand Down
3 changes: 2 additions & 1 deletion pkg/cybr/api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ func (c *Client) RemoveConfig() error {
return fmt.Errorf("ACL error. %s", err)
}

err = os.Remove(userHome + "/.cybr/config")
fullPath := userHome + "/.cybr/config"
err = os.Remove(fullPath)
if err != nil {
return fmt.Errorf("Failed to remove configuration file at %s/.cybr/config. %s", userHome, err)
}
Expand Down

0 comments on commit 6c197f9

Please sign in to comment.