2021-08-27 15:03:47 +00:00
|
|
|
using System.IO;
|
2020-02-12 14:16:19 +00:00
|
|
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
using NodaTime;
|
|
|
|
using NodaTime.Serialization.JsonNet;
|
|
|
|
|
2021-08-27 15:03:47 +00:00
|
|
|
namespace PluralKit.Core
|
|
|
|
{
|
2020-02-12 14:16:19 +00:00
|
|
|
public static class InitUtils
|
|
|
|
{
|
2020-06-13 17:36:43 +00:00
|
|
|
public static void InitStatic()
|
|
|
|
{
|
|
|
|
Database.InitStatic();
|
|
|
|
}
|
2021-08-27 15:03:47 +00:00
|
|
|
|
2020-02-12 14:16:19 +00:00
|
|
|
public static IConfigurationBuilder BuildConfiguration(string[] args) => new ConfigurationBuilder()
|
|
|
|
.SetBasePath(Directory.GetCurrentDirectory())
|
|
|
|
.AddJsonFile("pluralkit.conf", true)
|
|
|
|
.AddEnvironmentVariables()
|
|
|
|
.AddCommandLine(args);
|
2021-08-27 15:03:47 +00:00
|
|
|
|
2020-02-12 14:16:19 +00:00
|
|
|
public static JsonSerializerSettings BuildSerializerSettings() => new JsonSerializerSettings().BuildSerializerSettings();
|
|
|
|
|
|
|
|
public static JsonSerializerSettings BuildSerializerSettings(this JsonSerializerSettings settings)
|
|
|
|
{
|
|
|
|
settings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
|
|
|
|
return settings;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|