mirror of
https://git.lewd.wtf/PGR/ascnet
synced 2025-12-13 11:44:34 +01:00
Add project files.
This commit is contained in:
25
AscNet.Common/Common.cs
Normal file
25
AscNet.Common/Common.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using MongoDB.Driver;
|
||||
using Config.Net;
|
||||
|
||||
namespace AscNet.Common
|
||||
{
|
||||
public static class Common
|
||||
{
|
||||
public static readonly IConfig config;
|
||||
public static readonly MongoClient mongoClient;
|
||||
public static readonly IMongoDatabase db;
|
||||
|
||||
static Common()
|
||||
{
|
||||
config = new ConfigurationBuilder<IConfig>().UseJsonFile("Configs/config.json").Build();
|
||||
mongoClient = new(
|
||||
new MongoClientSettings
|
||||
{
|
||||
Server = new MongoServerAddress(config.Database.Host, config.Database.Port),
|
||||
// Credential = MongoCredential.CreateCredential("admin", config.Database.Username, config.Database.Password)
|
||||
}
|
||||
);
|
||||
db = mongoClient.GetDatabase(config.Database.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user