mirror of
https://github.com/rafi1212122/PemukulPaku
synced 2025-12-13 10:34:35 +01:00
Http w/ dispatch
This commit is contained in:
@@ -1,25 +1,61 @@
|
||||
using Config.Net;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace Common
|
||||
{
|
||||
public static class Global
|
||||
{
|
||||
public static IConfig config = new ConfigurationBuilder<IConfig>().UseJsonFile("config.json").Build();
|
||||
|
||||
public static MongoClient MongoClient = new MongoClient(config.DatabaseUri);
|
||||
public static IMongoDatabase db = MongoClient.GetDatabase("PemukulPaku");
|
||||
public static long GetUnixInSeconds() => ((DateTimeOffset)DateTime.UtcNow).ToUnixTimeSeconds();
|
||||
}
|
||||
|
||||
public interface IConfig
|
||||
{
|
||||
[Option(DefaultValue = VerboseLevel.Normal)]
|
||||
[Option(DefaultValue = VerboseLevel.Warns)]
|
||||
VerboseLevel VerboseLevel { get; }
|
||||
|
||||
[Option(DefaultValue = "mongodb://localhost:27017/crepebh")]
|
||||
string DatabaseUri { get; }
|
||||
[Option(DefaultValue = false)]
|
||||
bool UseLocalCache { get; }
|
||||
|
||||
[Option(DefaultValue = "mongodb://localhost:27017/PemukulPaku")]
|
||||
string DatabaseUri { get; }
|
||||
|
||||
[Option]
|
||||
IGameserver Gameserver { get; }
|
||||
|
||||
[Option]
|
||||
IHttp Http { get; }
|
||||
|
||||
public interface IGameserver
|
||||
{
|
||||
[Option(DefaultValue = "127.0.0.1")]
|
||||
public string Host { get; }
|
||||
|
||||
[Option(DefaultValue = (uint)(16100))]
|
||||
public uint Port { get; }
|
||||
|
||||
[Option(DefaultValue = "overseas01")]
|
||||
public string RegionName { get; }
|
||||
}
|
||||
|
||||
public interface IHttp
|
||||
{
|
||||
|
||||
[Option(DefaultValue = (uint)(80))]
|
||||
public uint HttpPort { get; }
|
||||
|
||||
[Option(DefaultValue = (uint)(443))]
|
||||
public uint HttpsPort { get; }
|
||||
}
|
||||
}
|
||||
|
||||
public enum VerboseLevel
|
||||
{
|
||||
Normal = 0,
|
||||
Debug = 1
|
||||
Errors = 0,
|
||||
Warns = 1,
|
||||
Debug = 2
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user