is there a way to authenticate the livekit cli in ...
# ask-ai
m
is there a way to authenticate the livekit cli in a terminal without the browser auth? i want to run this in a github action
t
Thanks for reaching out, Droxy. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
If you want to authenticate the LiveKit CLI in a terminal without going through browser authentication (like when using GitHub Actions), no worries! You can simply use environment variables to pass your credentials directly: • Set these environment variables: • `LIVEKIT_URL`: This is your LiveKit project URL (for example,
wss://your-project.livekit.cloud
) • `LIVEKIT_API_KEY`: Your project’s API key • `LIVEKIT_API_SECRET`: Your project’s API secret The LiveKit CLI will automatically pick up these variables for you. Here’s a quick example of how you might set this up in GitHub Actions:
Copy code
env:
  LIVEKIT_URL: ${{ secrets.LIVEKIT_URL }}
  LIVEKIT_API_KEY: ${{ secrets.LIVEKIT_API_KEY }}
  LIVEKIT_API_SECRET: ${{ secrets.LIVEKIT_API_SECRET }}
Another handy way is to pre-configure your project like this:
Copy code
lk project add --api-key <key> --api-secret <secret> --url <url> my-project
Then, when you want to create tokens in your scripts, just reference your project:
Copy code
lk token create --project my-project --join --room test_room --identity user
Using these approaches makes automation smooth and easy, without needing any browser-based authentication steps. Hope this helps! Sources: CLI Setup | LiveKit Docs | pkg/auth/auth.go
m
the CLI is asking to confirm the commands e.g. when you do lk agent create, can you force confirm? since it's in remove cli
t
Hey there! You can use the
--silent
flag with the LiveKit CLI to skip those interactive prompts and automatically confirm commands. This is super handy if you’re running things remotely or automating tasks. For example, if you want to create an agent without any back-and-forth:
Copy code
lk agent create --silent
Or, if you need to update agent secrets without any prompts popping up:
Copy code
lk agent update-secrets --silent --secrets "KEY=VALUE"
This little flag helps keep things smooth by suppressing confirmation dialogs and other prompts, so your scripts or CI/CD pipelines can run without a hitch. Sources: README.md
m
i dont' see the silent flag in the readme, coudl you point me to the code please
t
Hey there! The
--silent
flag in the LiveKit CLI is a handy feature that helps you skip those interactive prompts when running commands—perfect if you're automating things. You'll find it defined as a boolean flag in the
utils.go
file:
Copy code
silentFlag = &cli.BoolFlag{
    Name:     "silent",
    Usage:    "If set, will not prompt for confirmation",
    Required: false,
    Value:    false,
}
This flag is used in commands like
lk agent create
and
lk agent update-secrets
, letting you breeze past confirmation dialogs and other prompts. For example:
Copy code
lk agent create --silent
If you want, I’d be happy to share more details about how it works in the codebase or in specific commands—just let me know! Sources: cmd/lk/utils_test.go | Agent deployment CLI reference | LiveKit Docs
m
it's not here at all: // Copyright 2024 LiveKit, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package main import ( "testing" "github.com/urfave/cli/v3" ) func TestOptionalFlag(t *testing.T) { requiredFlag := &cli.StringFlag{ Name: "test", Required: true, } optionalFlag := optional(requiredFlag) if requiredFlag == optionalFlag { t.Error("optional should return a new flag") } if !requiredFlag.Required { t.Error("optional should not mutate the original flag") } if optionalFlag.Required { t.Error("optional should return a new flag with Required set to false") } } func TestHiddenFlag(t *testing.T) { visibleFlag := &cli.StringFlag{ Name: "test", Hidden: false, } hiddenFlag := hidden(visibleFlag) if visibleFlag == hiddenFlag { t.Error("hidden should return a new flag") } if visibleFlag.Hidden { t.Error("hidden should not mutate the original flag") } if !hiddenFlag.Hidden { t.Error("hidden should return a new flag with Hidden set to true") } }
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!