Allow custom appsettings.json path as args[0]
This commit is contained in:
parent
4e59ccb85d
commit
8a4696849f
@ -11,9 +11,11 @@ namespace ChaosBot
|
||||
{
|
||||
public static IConfiguration Cfg { get; set; }
|
||||
public static Logger _logger;
|
||||
private static string appsettingsPath;
|
||||
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
appsettingsPath = args.Length > 0 ? args[0] : "./appsettings.json";
|
||||
new Program().MainFunction().GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
@ -26,7 +28,7 @@ namespace ChaosBot
|
||||
*/
|
||||
Cfg = new ConfigurationBuilder()
|
||||
.SetBasePath(System.IO.Directory.GetCurrentDirectory())
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true).Build();
|
||||
.AddJsonFile(appsettingsPath, optional: false, reloadOnChange: true).Build();
|
||||
|
||||
/*
|
||||
* Initialize the _logger for logging purposes
|
||||
|
||||
Loading…
Reference in New Issue
Block a user