PluralKit/PluralKit.Core/Utils/InitUtils.cs

31 lines
874 B
C#
Raw Normal View History

using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using NodaTime;
using NodaTime.Serialization.JsonNet;
namespace PluralKit.Core;
public static class InitUtils
2021-08-27 15:03:47 +00:00
{
public static void InitStatic()
{
Database.InitStatic();
}
2021-08-27 15:03:47 +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
public static JsonSerializerSettings BuildSerializerSettings() =>
new JsonSerializerSettings().BuildSerializerSettings();
public static JsonSerializerSettings BuildSerializerSettings(this JsonSerializerSettings settings)
{
settings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
return settings;
}
}