fix(agent): pass the State Store CA base64-encoded; the OpenShell gateway rejects newlines in the environment (#1864)
This commit is contained in:
2 files changed
+10
-2
No files matched your search
@@ -3,6 +3,7 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
@@ -80,11 +81,17 @@ func runCommand(args []string, getenv func(string) string, stderr io.Writer, run
|
||||
stateStoreToken = getenv("STATE_STORE_TOKEN")
|
||||
}
|
||||
|
||||
stateStoreCA, err := base64.StdEncoding.DecodeString(getenv("STATE_STORE_CA_BASE64"))
|
||||
if err != nil {
|
||||
_, _ = fmt.Fprintf(stderr, "error: STATE_STORE_CA_BASE64: %v\n", err)
|
||||
return 1
|
||||
}
|
||||
|
||||
if err := runWorker(ctx, agentworker.Settings{
|
||||
NATSURL: natsURL,
|
||||
StateStoreTarget: stateStoreURL,
|
||||
StateStoreToken: stateStoreToken,
|
||||
StateStoreCA: []byte(getenv("STATE_STORE_CA")),
|
||||
StateStoreCA: stateStoreCA,
|
||||
ModelProxy: getenv(egress.ModelProxyEnv),
|
||||
ModelProxyHosts: egress.ParseHosts(getenv(egress.ModelProxyHostsEnv)),
|
||||
ModelProxyCA: getenv(egress.ModelProxyCAEnv),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package egress
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/url"
|
||||
@@ -39,7 +40,7 @@ func DirectWorkerEnv(nats, stateStore string, e Endpoints) []string {
|
||||
env = append(env, "STATE_STORE_TOKEN="+e.StateStoreToken)
|
||||
}
|
||||
if len(e.StateStoreCA) > 0 {
|
||||
env = append(env, "STATE_STORE_CA="+string(e.StateStoreCA))
|
||||
env = append(env, "STATE_STORE_CA_BASE64="+base64.StdEncoding.EncodeToString(e.StateStoreCA))
|
||||
}
|
||||
}
|
||||
return env
|
||||
|
||||
Reference in new issue
Block a user