Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 4 additions & 19 deletions cmd/lk/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,6 @@ func createAgent(ctx context.Context, cmd *cli.Command) error {
fmt.Printf("Creating new agent\n")
}

regions := cmd.StringSlice("regions")
if len(regions) != 0 {
lkConfig.Agent.Regions = regions
}

secrets, err := requireSecrets(ctx, cmd, false, false)
if err != nil {
return err
Expand Down Expand Up @@ -412,9 +407,11 @@ func createAgent(ctx context.Context, cmd *cli.Command) error {
}
}

regions := cmd.StringSlice("regions")

req := &lkproto.CreateAgentRequest{
Secrets: secrets,
Regions: lkConfig.Agent.Regions,
Regions: regions,
}

resp, err := agentsClient.CreateAgent(ctx, req)
Expand Down Expand Up @@ -524,16 +521,10 @@ func createAgentConfig(ctx context.Context, cmd *cli.Command) error {
return fmt.Errorf("invalid project URL: %s", project.URL)
}

var regions []string
for _, regionalAgent := range response.Agents[0].AgentDeployments {
regions = append(regions, regionalAgent.Region)
}

agent := response.Agents[0]
lkConfig := config.NewLiveKitTOML(matches[1])
lkConfig.Agent = &config.LiveKitTOMLAgentConfig{
ID: agent.AgentId,
Regions: regions,
ID: agent.AgentId,
}

if err := lkConfig.SaveTOMLFile(workingDir, tomlFilename); err != nil {
Expand Down Expand Up @@ -703,14 +694,8 @@ func updateAgent(ctx context.Context, cmd *cli.Command) error {
return fmt.Errorf("no agent config found in [%s]", tomlFilename)
}

regions := cmd.StringSlice("regions")
if len(regions) != 0 {
lkConfig.Agent.Regions = regions
}

req := &lkproto.UpdateAgentRequest{
AgentId: lkConfig.Agent.ID,
Regions: lkConfig.Agent.Regions,
}

secrets, err := requireSecrets(ctx, cmd, false, true)
Expand Down
6 changes: 2 additions & 4 deletions pkg/config/livekit.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ var (

// Deprecated: use LiveKitTOML instead
type AgentTOML struct {
ProjectSubdomain string `toml:"project_subdomain"`
Regions []string `toml:"regions"`
ProjectSubdomain string `toml:"project_subdomain"`
}

type LiveKitTOML struct {
Expand All @@ -52,8 +51,7 @@ type LiveKitTOMLProjectConfig struct {
}

type LiveKitTOMLAgentConfig struct {
ID string `toml:"id"`
Regions []string `toml:"regions"`
ID string `toml:"id"`
}

func NewLiveKitTOML(forSubdomain string) *LiveKitTOML {
Expand Down
Loading