Skip to content

Commit

Permalink
Merge pull request #10 from atlanhq/default-client-initialized
Browse files Browse the repository at this point in the history
Set defaultatlanclient to atlanclient when initializing
  • Loading branch information
0xquark authored Apr 1, 2024
2 parents 07c2581 + 6f1d4d9 commit d3ce94c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions atlan/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func Init() error {
return nil
}

// Context creates a new AtlanClient instance.
func Context(apiKey, baseURL string) (*AtlanClient, error) {
client := &http.Client{}
logger := log.New(os.Stdout, "AtlanClient: ", log.LstdFlags|log.Lshortfile)
Expand All @@ -58,7 +57,8 @@ func Context(apiKey, baseURL string) (*AtlanClient, error) {
} else {
logger = log.New(io.Discard, "", 0) // Logger that discards all log output
}
return &AtlanClient{

atlanClient := &AtlanClient{
Session: client,
host: baseURL,
ApiKey: apiKey,
Expand All @@ -80,7 +80,12 @@ func Context(apiKey, baseURL string) (*AtlanClient, error) {
View: NewSearchView(),
// Add other methods
},
}, nil
}

// Initialize the default atlan client
DefaultAtlanClient = atlanClient

return atlanClient, nil
}

func NewContext() *AtlanClient {
Expand Down

0 comments on commit d3ce94c

Please sign in to comment.