Since am working on dev mode and my Livekit creden...
# ask-ai
e
Since am working on dev mode and my Livekit credentials point to both the dev and production, how would the frontend know whether to use the the livekit cloud or the dev running in my local machine. Is there a way to switch?
t
Thanks for reaching out, Brian. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! To smoothly switch between LiveKit Cloud and your local development environment in the frontend, you just need to update a few environment variables that tell your app where to connect. Here’s a simple step-by-step guide to help you out: 1. Locate the Environment Configuration File: Look for the environment file in your project, usually named something like
.env.local
or
.env
. 2. Update the `LIVEKIT_URL`: ◦ If you’re using LiveKit Cloud: set it to
wss://<your-project>.livekit.cloud
. ◦ If you’re working with your Local Server: use
ws://localhost:7880
(or
wss://
if you have TLS enabled). 1. Set API Key and Secret: Make sure that
LIVEKIT_API_KEY
and
LIVEKIT_API_SECRET
match the credentials for the environment you want to connect to. 2. Restart the Frontend Development Server: After making these changes, just restart your app (for example, with
pnpm dev
) so everything updates properly. Just by tweaking these settings, you’ll be able to switch between environments effortlessly. If you have any questions or run into any issues, feel free to reach out—I’m here to help! Sources: React Components & UI Library | livekit/livekit_composite | DeepWiki | Deploying to custom environments | LiveKit docs | README.md | frontend/lib/server-utils.ts | Deploying to custom environments | LiveKit Docs