forked from mayuki/Cocona
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
31 lines (26 loc) · 850 Bytes
/
Copy pathProgram.cs
File metadata and controls
31 lines (26 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using Cocona;
using Microsoft.Extensions.Configuration;
namespace CoconaSample.InAction.AppConfiguration;
class Program
{
private bool _configValue1;
private string _configValue2;
// Example (on bash):
// dotnet run --
// DOTNET_ENVIROMENT=Development dotnet run --
public Program(IConfiguration configuration)
{
// See. https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-3.1
_configValue1 = configuration.GetValue<bool>("ConfigValue1");
_configValue2 = configuration.GetValue<string>("ConfigValue2");
}
static void Main(string[] args)
{
CoconaApp.Run<Program>(args);
}
public void Run()
{
Console.WriteLine($"ConfigValue1: {_configValue1}");
Console.WriteLine($"ConfigValue2: {_configValue2}");
}
}