mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 11:37:01 -07:00
Added access token to collect header if supplied
This commit is contained in:
parent
09c5af44b9
commit
be1d473950
1 changed files with 6 additions and 0 deletions
|
|
@ -50,6 +50,7 @@ type QueryParams struct {
|
|||
IpmitoolPath string
|
||||
OutputPath string
|
||||
ForceUpdate bool
|
||||
AccessToken string
|
||||
}
|
||||
|
||||
func NewClient(l *log.Logger, q *QueryParams) (*bmclib.Client, error) {
|
||||
|
|
@ -209,6 +210,11 @@ func CollectAll(probeStates *[]ScannedResult, l *log.Logger, q *QueryParams) err
|
|||
headers := make(map[string]string)
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
// use access token in authorization header if we have it
|
||||
if q.AccessToken != "" {
|
||||
headers["Authorization"] = "Bearer " + q.AccessToken
|
||||
}
|
||||
|
||||
body, err := json.MarshalIndent(data, "", " ")
|
||||
if err != nil {
|
||||
l.Log.Errorf("could not marshal JSON: %v", err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue