From 1876a10b2695afa356d60c31714f3ffc4f9adfa6 Mon Sep 17 00:00:00 2001 From: Jonas Dellinger Date: Sat, 21 May 2022 20:13:30 +0200 Subject: [PATCH] Abort example if env variables are not set --- SpotifyAPI.Web.Examples/Example.CLI.CustomHTML/Program.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/SpotifyAPI.Web.Examples/Example.CLI.CustomHTML/Program.cs b/SpotifyAPI.Web.Examples/Example.CLI.CustomHTML/Program.cs index f6e7e6b8..b5daf38e 100644 --- a/SpotifyAPI.Web.Examples/Example.CLI.CustomHTML/Program.cs +++ b/SpotifyAPI.Web.Examples/Example.CLI.CustomHTML/Program.cs @@ -16,6 +16,13 @@ namespace Example.CLI.CustomHTML 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( new Uri("http://localhost:5000/callback"), 5000,