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
16 changes: 10 additions & 6 deletions cmd/lk/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ var (
project *config.ProjectConfig
AppCommands = []*cli.Command{
{
Name: "app",
Category: "Core",
Name: "app",
Usage: "Initialize and manage applications",
Commands: []*cli.Command{
{
Name: "create",
Expand Down Expand Up @@ -292,7 +292,10 @@ func setupTemplate(ctx context.Context, cmd *cli.Command) error {
}

fmt.Println("Instantiating environment...")
addlEnv := &map[string]string{"LIVEKIT_SANDBOX_ID": sandboxID}
addlEnv := &map[string]string{
"LIVEKIT_SANDBOX_ID": sandboxID,
"NEXT_PUBLIC_LIVEKIT_SANDBOX_ID": sandboxID,
}
env, err := instantiateEnv(ctx, cmd, appName, addlEnv)
if err != nil {
return err
Expand Down Expand Up @@ -368,9 +371,10 @@ func manageEnv(ctx context.Context, cmd *cli.Command) error {

func instantiateEnv(ctx context.Context, cmd *cli.Command, rootPath string, addlEnv *map[string]string) (map[string]string, error) {
env := map[string]string{
"LIVEKIT_API_KEY": project.APIKey,
"LIVEKIT_API_SECRET": project.APISecret,
"LIVEKIT_URL": project.URL,
"LIVEKIT_API_KEY": project.APIKey,
"LIVEKIT_API_SECRET": project.APISecret,
"LIVEKIT_URL": project.URL,
"NEXT_PUBLIC_LIVEKIT_URL": project.URL,
}
if addlEnv != nil {
for k, v := range *addlEnv {
Expand Down
19 changes: 9 additions & 10 deletions cmd/lk/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,16 @@ const (
)

var (
revoke bool
timeout int64 = 60 * 15
interval int64 = 4
serverURL string = cloudAPIServerURL
dashboardURL string = cloudDashboardURL
authClient AuthClient
AuthCommands = []*cli.Command{
revoke bool
timeout int64 = 60 * 15
interval int64 = 4
serverURL string = cloudAPIServerURL
dashboardURL string = cloudDashboardURL
authClient AuthClient
CloudCommands = []*cli.Command{
{
Name: "cloud",
Usage: "Interacting with LiveKit Cloud",
Category: "Cloud",
Name: "cloud",
Usage: "Interact with LiveKit Cloud services",
Commands: []*cli.Command{
{
Name: "auth",
Expand Down
6 changes: 2 additions & 4 deletions cmd/lk/dispatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ import (
var (
DispatchCommands = []*cli.Command{
{
Name: "dispatch",
Usage: "Create, list, and delete agent dispatches",
Category: "Agent",

Name: "dispatch",
Usage: "Create, list, and delete agent dispatches",
Commands: []*cli.Command{
{
Name: "list",
Expand Down
5 changes: 2 additions & 3 deletions cmd/lk/egress.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ See cmd/livekit-cli/examples`
var (
EgressCommands = []*cli.Command{
{
Name: "egress",
Usage: "Record or stream media from LiveKit to elsewhere",
Category: "I/O",
Name: "egress",
Usage: "Record or stream media from LiveKit to elsewhere",
Commands: []*cli.Command{
{
Name: "start",
Expand Down
51 changes: 22 additions & 29 deletions cmd/lk/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,11 @@ import (
lksdk "github.com/livekit/server-sdk-go/v2"
)

const ingressCategory = "Ingress"

var (
IngressCommands = []*cli.Command{
{
Name: "ingress",
Usage: "Import outside media sources into a LiveKit room",
Category: "I/O",
Name: "ingress",
Usage: "Import outside media sources into a LiveKit room",
Commands: []*cli.Command{
{
Name: "create",
Expand Down Expand Up @@ -98,12 +95,11 @@ var (

// Deprecated commands kept for compatibility
{
Hidden: true, // deprecated: use `ingress create`
Name: "create-ingress",
Usage: "Create an ingress",
Before: createIngressClient,
Action: createIngress,
Category: ingressCategory,
Hidden: true, // deprecated: use `ingress create`
Name: "create-ingress",
Usage: "Create an ingress",
Before: createIngressClient,
Action: createIngress,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "request",
Expand All @@ -113,12 +109,11 @@ var (
},
},
{
Hidden: true, // deprecated: use `ingress update`
Name: "update-ingress",
Usage: "Update an ingress",
Before: createIngressClient,
Action: updateIngress,
Category: ingressCategory,
Hidden: true, // deprecated: use `ingress update`
Name: "update-ingress",
Usage: "Update an ingress",
Before: createIngressClient,
Action: updateIngress,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "request",
Expand All @@ -128,12 +123,11 @@ var (
},
},
{
Hidden: true, // deprecated: use `ingress list`
Name: "list-ingress",
Usage: "List all active ingress",
Before: createIngressClient,
Action: listIngress,
Category: ingressCategory,
Hidden: true, // deprecated: use `ingress list`
Name: "list-ingress",
Usage: "List all active ingress",
Before: createIngressClient,
Action: listIngress,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "room",
Expand All @@ -148,12 +142,11 @@ var (
},
},
{
Hidden: true, // deprecated: use `ingress delete`
Name: "delete-ingress",
Usage: "Delete ingress",
Before: createIngressClient,
Action: deleteIngress,
Category: ingressCategory,
Hidden: true, // deprecated: use `ingress delete`
Name: "delete-ingress",
Usage: "Delete ingress",
Before: createIngressClient,
Action: deleteIngress,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "id",
Expand Down
9 changes: 4 additions & 5 deletions cmd/lk/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ import (
var (
JoinCommands = []*cli.Command{
{
Hidden: true, // deprecated: use `lk room join`
Name: "join-room",
Usage: "Joins a room as a participant",
Action: _deprecatedJoinRoom,
Category: "Simulate",
Hidden: true, // deprecated: use `lk room join`
Name: "join-room",
Usage: "Joins a room as a participant",
Action: _deprecatedJoinRoom,
Flags: []cli.Flag{
roomFlag,
identityFlag,
Expand Down
7 changes: 3 additions & 4 deletions cmd/lk/loadtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ import (

var LoadTestCommands = []*cli.Command{
{
Name: "load-test",
Usage: "Run load tests against LiveKit with simulated publishers & subscribers",
Category: "Simulate",
Action: loadTest,
Name: "load-test",
Usage: "Run load tests against LiveKit with simulated publishers & subscribers",
Action: loadTest,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "room",
Expand Down
10 changes: 5 additions & 5 deletions cmd/lk/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,18 @@ func main() {
},
}

app.Commands = append(app.Commands, AuthCommands...)
app.Commands = append(app.Commands, AppCommands...)
app.Commands = append(app.Commands, TokenCommands...)
app.Commands = append(app.Commands, CloudCommands...)
app.Commands = append(app.Commands, ProjectCommands...)
app.Commands = append(app.Commands, RoomCommands...)
app.Commands = append(app.Commands, TokenCommands...)
app.Commands = append(app.Commands, JoinCommands...)
app.Commands = append(app.Commands, DispatchCommands...)
app.Commands = append(app.Commands, EgressCommands...)
app.Commands = append(app.Commands, IngressCommands...)
app.Commands = append(app.Commands, SIPCommands...)
app.Commands = append(app.Commands, ReplayCommands...)
app.Commands = append(app.Commands, LoadTestCommands...)
app.Commands = append(app.Commands, ProjectCommands...)
app.Commands = append(app.Commands, SIPCommands...)
app.Commands = append(app.Commands, DispatchCommands...)

// Register cleanup hook for SIGINT, SIGTERM, SIGQUIT
ctx, stop := signal.NotifyContext(
Expand Down
7 changes: 3 additions & 4 deletions cmd/lk/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ import (
var (
ProjectCommands = []*cli.Command{
{
Name: "project",
Usage: "Add or remove projects and view existing project properties",
Category: "Core",
Before: loadProjectConfig,
Name: "project",
Usage: "Add or remove projects and view existing project properties",
Before: loadProjectConfig,
Commands: []*cli.Command{
{
Name: "add",
Expand Down
1 change: 0 additions & 1 deletion cmd/lk/replay.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ var (
{
Name: "replay",
Usage: "experimental (not yet available)",
Category: "I/O",
Hidden: true,
HideHelpCommand: true,
Commands: []*cli.Command{
Expand Down
1 change: 0 additions & 1 deletion cmd/lk/room.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ var (
{
Name: "room",
Usage: "Create or delete rooms and manage existing room properties",
Category: "Core",
HideHelpCommand: true,
Commands: []*cli.Command{
{
Expand Down
Loading
Loading