forked from fajiao/OnvifServer-CSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
871 B
52 lines
871 B
using EC.Helper.FileExt;
|
|
using Microsoft.Extensions.Configuration;
|
|
using System.IO;
|
|
|
|
namespace OnvifSocketServer
|
|
{
|
|
public class AppConfig
|
|
{
|
|
#region Attr
|
|
|
|
private static IConfiguration config;
|
|
|
|
private static IConfiguration Config
|
|
{
|
|
get
|
|
{
|
|
if (config == null)
|
|
{
|
|
string configPath = Path.Combine(Directory.GetCurrentDirectory(), "appsettings.json");
|
|
config = JsonHelper.ReadConfiguration(configPath);
|
|
}
|
|
return config;
|
|
}
|
|
}
|
|
|
|
public static T Get<T>(string key)
|
|
{
|
|
return Config.GetValue<T>(key);
|
|
}
|
|
|
|
#endregion Attr
|
|
|
|
#region Apis
|
|
|
|
public static string GetApi(string key)
|
|
{
|
|
return Get<string>($"Apis:{key}");
|
|
}
|
|
|
|
public static string GetOnvifHttpUrl()
|
|
{
|
|
return GetApi("onvif_http_url");
|
|
}
|
|
|
|
public static string GetOnvifHttpsUrl()
|
|
{
|
|
return GetApi("onvif_https_url");
|
|
}
|
|
|
|
#endregion Apis
|
|
}
|
|
}
|