From e01d6d407809ab24e92a31401ed9144bb28765ec Mon Sep 17 00:00:00 2001 From: Reuben Miller Date: Mon, 10 Jun 2024 17:43:21 +0200 Subject: [PATCH] fix(sessions): set C8Y_SESSION based on either path or sessionUri --- pkg/c8ysession/c8ysession.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/c8ysession/c8ysession.go b/pkg/c8ysession/c8ysession.go index d1af4425b..611935f72 100644 --- a/pkg/c8ysession/c8ysession.go +++ b/pkg/c8ysession/c8ysession.go @@ -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, @@ -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 }