mirror of
https://onedev.fprog.nl/DiscordClient
synced 2026-02-13 14:53:42 +01:00
Using IConfiguration for obtaining token.
This commit is contained in:
parent
d630280dc1
commit
805f85eb2f
|
|
@ -9,12 +9,11 @@ IConfiguration configuration = new ConfigurationBuilder()
|
||||||
.AddXmlFile("config.xml", true)
|
.AddXmlFile("config.xml", true)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
string? token = Environment.GetEnvironmentVariable("DISCORD_TOKEN");
|
string? token = configuration.GetSection("Token").Value;
|
||||||
|
|
||||||
if (token == null)
|
if(token is null)
|
||||||
{
|
{
|
||||||
// Exit.
|
Console.WriteLine("Token has not been found in any form of configuration.");
|
||||||
Console.WriteLine("Token is null. Make sure you set the DISCORD_TOKEN environmental variable.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue