Abort example if env variables are not set

This commit is contained in:
Jonas Dellinger 2022-05-21 20:13:30 +02:00
parent 7aea4e365e
commit 1876a10b26

View File

@ -16,6 +16,13 @@ namespace Example.CLI.CustomHTML
public static async Task Main() public static async Task Main()
{ {
if (string.IsNullOrEmpty(clientId) || string.IsNullOrEmpty(clientSecret))
{
throw new NullReferenceException(
"Please set SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET via environment variables before starting the program"
);
}
_server = new EmbedIOAuthServer( _server = new EmbedIOAuthServer(
new Uri("http://localhost:5000/callback"), new Uri("http://localhost:5000/callback"),
5000, 5000,