Skip to content

Commit dfa7075

Browse files
authored
simplify regions, remove from toml (#685)
1 parent ccbe603 commit dfa7075

File tree

2 files changed

+6
-23
lines changed

2 files changed

+6
-23
lines changed

cmd/lk/agent.go

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -386,11 +386,6 @@ func createAgent(ctx context.Context, cmd *cli.Command) error {
386386
fmt.Printf("Creating new agent\n")
387387
}
388388

389-
regions := cmd.StringSlice("regions")
390-
if len(regions) != 0 {
391-
lkConfig.Agent.Regions = regions
392-
}
393-
394389
secrets, err := requireSecrets(ctx, cmd, false, false)
395390
if err != nil {
396391
return err
@@ -419,9 +414,11 @@ func createAgent(ctx context.Context, cmd *cli.Command) error {
419414
}
420415
}
421416

417+
regions := cmd.StringSlice("regions")
418+
422419
req := &lkproto.CreateAgentRequest{
423420
Secrets: secrets,
424-
Regions: lkConfig.Agent.Regions,
421+
Regions: regions,
425422
}
426423

427424
resp, err := agentsClient.CreateAgent(ctx, req)
@@ -531,16 +528,10 @@ func createAgentConfig(ctx context.Context, cmd *cli.Command) error {
531528
return fmt.Errorf("invalid project URL: %s", project.URL)
532529
}
533530

534-
var regions []string
535-
for _, regionalAgent := range response.Agents[0].AgentDeployments {
536-
regions = append(regions, regionalAgent.Region)
537-
}
538-
539531
agent := response.Agents[0]
540532
lkConfig := config.NewLiveKitTOML(matches[1])
541533
lkConfig.Agent = &config.LiveKitTOMLAgentConfig{
542-
ID: agent.AgentId,
543-
Regions: regions,
534+
ID: agent.AgentId,
544535
}
545536

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

713-
regions := cmd.StringSlice("regions")
714-
if len(regions) != 0 {
715-
lkConfig.Agent.Regions = regions
716-
}
717-
718704
req := &lkproto.UpdateAgentRequest{
719705
AgentId: lkConfig.Agent.ID,
720-
Regions: lkConfig.Agent.Regions,
721706
}
722707

723708
secrets, err := requireSecrets(ctx, cmd, false, true)

pkg/config/livekit.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ var (
3838

3939
// Deprecated: use LiveKitTOML instead
4040
type AgentTOML struct {
41-
ProjectSubdomain string `toml:"project_subdomain"`
42-
Regions []string `toml:"regions"`
41+
ProjectSubdomain string `toml:"project_subdomain"`
4342
}
4443

4544
type LiveKitTOML struct {
@@ -52,8 +51,7 @@ type LiveKitTOMLProjectConfig struct {
5251
}
5352

5453
type LiveKitTOMLAgentConfig struct {
55-
ID string `toml:"id"`
56-
Regions []string `toml:"regions"`
54+
ID string `toml:"id"`
5755
}
5856

5957
func NewLiveKitTOML(forSubdomain string) *LiveKitTOML {

0 commit comments

Comments
 (0)