-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #970 from jinlinGuan/bootstrap-issue-804
feat: use baseUrlFunc instead baseUrl for Clients
- Loading branch information
Showing
12 changed files
with
704 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (C) 2025 IOTech Ltd | ||
|
||
package clients | ||
|
||
import goErrors "errors" | ||
|
||
type ClientBaseUrlFunc func() (string, error) | ||
|
||
// GetDefaultClientBaseUrlFunc returns a ClientBaseUrlFunc that always returns the provided baseUrl. | ||
func GetDefaultClientBaseUrlFunc(baseUrl string) ClientBaseUrlFunc { | ||
return func() (string, error) { | ||
return baseUrl, nil | ||
} | ||
} | ||
|
||
// GetBaseUrl retrieves the base URL using the provided ClientBaseUrlFunc. | ||
func GetBaseUrl(baseUrlFunc ClientBaseUrlFunc) (string, error) { | ||
if baseUrlFunc == nil { | ||
return "", goErrors.New("could not find ClientBaseUrlFunc to get base url") | ||
} | ||
return baseUrlFunc() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.