diff --git a/application-server/dotnet/Program.cs b/application-server/dotnet/Program.cs index 62b3f00c..ff2deecd 100644 --- a/application-server/dotnet/Program.cs +++ b/application-server/dotnet/Program.cs @@ -15,7 +15,7 @@ IConfiguration config = new ConfigurationBuilder() // Load env variables var SERVER_PORT = config.GetValue("SERVER_PORT"); var LIVEKIT_API_KEY = config.GetValue("LIVEKIT_API_KEY"); -var LIVEKIT_API_SECRET = config.GetValue("LIVEKIT_API_SECRET"); // ATTENTION! Make sure that this string is at least 32 characters long +var LIVEKIT_API_SECRET = config.GetValue("LIVEKIT_API_SECRET"); // Enable CORS support builder.Services.AddCors(options => @@ -74,4 +74,15 @@ string CreateLiveKitJWT(string roomName, string participantName) return new JwtSecurityTokenHandler().WriteToken(token); } -app.Run(); \ No newline at end of file +if (LIVEKIT_API_KEY == null || LIVEKIT_API_SECRET == null) +{ + Console.Error.WriteLine("\nERROR: LIVEKIT_API_KEY and LIVEKIT_API_SECRET not set\n"); + Environment.Exit(1); +} +if (LIVEKIT_API_SECRET.Length < 32) +{ + Console.Error.WriteLine("\nERROR: LIVEKIT_API_SECRET must be at least 32 characters long\n"); + Environment.Exit(1); +} + +app.Run();