Skip to content

Commit

Permalink
fix(sessions): set C8Y_SESSION based on either path or sessionUri
Browse files Browse the repository at this point in the history
  • Loading branch information
reubenmiller committed Jun 10, 2024
1 parent 73996ab commit e01d6d4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/c8ysession/c8ysession.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func GetVariablesFromSession(session *CumulocitySession, client *c8y.Client, set
}

output := map[string]interface{}{
// "C8Y_SESSION": c.GetSessionFile(),
"C8Y_SESSION": "",
"C8Y_URL": host,
"C8Y_BASEURL": host,
"C8Y_HOST": host,
Expand All @@ -209,6 +209,13 @@ func GetVariablesFromSession(session *CumulocitySession, client *c8y.Client, set
"C8Y_HEADER_AUTHORIZATION": authHeaderValue,
"C8Y_HEADER": authHeader,
}

// Favor older path style over sessionUri to help with backwards compatibility
if session.Path != "" {
output["C8Y_SESSION"] = session.Path
} else if session.SessionUri != "" {
output["C8Y_SESSION"] = session.SessionUri
}
return output
}

Expand Down

0 comments on commit e01d6d4

Please sign in to comment.