Skip to content

Commit

Permalink
Allow specifying agents configuration on room creation (#347)
Browse files Browse the repository at this point in the history
  • Loading branch information
biglittlebigben authored Jun 28, 2024
1 parent 5a9c47c commit 0b79f3e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cmd/livekit-cli/room.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ var (
Name: "track-egress-file",
Usage: "AutoTrackEgress json file (see examples/auto-track-egress.json)",
},
&cli.StringFlag{
Name: "agents-file",
Usage: "Agents configuration json file",
},
&cli.StringFlag{
Name: "room-configuration",
Usage: "Name of the room configuration to associate with the created room",
Expand Down Expand Up @@ -285,6 +289,18 @@ func createRoom(c *cli.Context) error {
req.Egress.Tracks = trackEgress
}

if agentsFile := c.String("agents-file"); agentsFile != "" {
agent := &livekit.RoomAgent{}
b, err := os.ReadFile(agentsFile)
if err != nil {
return err
}
if err = protojson.Unmarshal(b, agent); err != nil {
return err
}
req.Agent = agent
}

if roomConfig := c.String("room-configuration"); roomConfig != "" {
req.ConfigName = roomConfig
}
Expand Down

0 comments on commit 0b79f3e

Please sign in to comment.