mirror of
https://onedev.fprog.nl/DiscordClient
synced 2025-12-29 10:18:36 +01:00
Added CommandLine configuration.
This commit is contained in:
parent
805f85eb2f
commit
20ed3dd6d8
|
|
@ -15,6 +15,7 @@
|
|||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Xml" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -5,13 +5,14 @@ using Microsoft.Extensions.Configuration;
|
|||
|
||||
IConfiguration configuration = new ConfigurationBuilder()
|
||||
.AddEnvironmentVariables()
|
||||
.AddCommandLine(args)
|
||||
.AddJsonFile("config.json", true)
|
||||
.AddXmlFile("config.xml", true)
|
||||
.Build();
|
||||
|
||||
string? token = configuration.GetSection("Token").Value;
|
||||
|
||||
if(token is null)
|
||||
if (token is null)
|
||||
{
|
||||
Console.WriteLine("Token has not been found in any form of configuration.");
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in a new issue