handle agent worker jwt (#3668)

* handle agent worker jwt

* test

* tidy

* tidy

* deps
This commit is contained in:
Paul Wells
2025-05-15 08:23:10 -07:00
committed by GitHub
parent 3b359d8b74
commit c9385edd1e
7 changed files with 75 additions and 33 deletions
+9
View File
@@ -34,6 +34,7 @@ import (
"github.com/livekit/livekit-server/pkg/sfu/pacer"
"github.com/livekit/livekit-server/pkg/sfu/streamallocator"
"github.com/livekit/mediatransportutil/pkg/rtcconfig"
"github.com/livekit/protocol/agent"
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger"
redisLiveKit "github.com/livekit/protocol/redis"
@@ -64,6 +65,7 @@ type Config struct {
TURN TURNConfig `yaml:"turn,omitempty"`
Ingress IngressConfig `yaml:"ingress,omitempty"`
SIP SIPConfig `yaml:"sip,omitempty"`
Agents AgentsConfig `yaml:"agents,omitempty"`
WebHook webhook.WebHookConfig `yaml:"webhook,omitempty"`
NodeSelector NodeSelectorConfig `yaml:"node_selector,omitempty"`
KeyFile string `yaml:"key_file,omitempty"`
@@ -273,6 +275,10 @@ type IngressConfig struct {
type SIPConfig struct{}
type AgentsConfig struct {
WorkerToken agent.WorkerTokenConfig `yaml:"worker_token,omitempty"`
}
type APIConfig struct {
// amount of time to wait for API to execute, default 2s
ExecutionTimeout time.Duration `yaml:"execution_timeout,omitempty"`
@@ -725,6 +731,9 @@ func (conf *Config) updateFromCLI(c *cli.Context, baseFlags []cli.Flag) error {
return errors.New("Could not parse keys, it needs to be exactly, \"key: secret\", including the space")
}
}
if c.String("agents-jwt-keys") != "" {
conf.Agents.WorkerToken.Keys = c.String("agents-jwt-keys")
}
if c.IsSet("region") {
conf.Region = c.String("region")
}