using Bowin.Common.Utility; using Microsoft.Extensions.Configuration; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; namespace OrderSystem.Web { public class Configuration { public static Configuration Current { get { var configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json") .Build(); Configuration result = new Configuration(); result.AppSettings = configuration.GetSection("AppSettings").Get(); result.CROSDomainList = configuration.GetSection("Web") .GetSection("Cros") .GetValue("Domain") .Split(",", StringSplitOptions.RemoveEmptyEntries) .Select(x => x.Trim()).ToList(); result.WxConfig = configuration.GetSection("WxConfig").Get(); return result; } } public AppSettings AppSettings { get; set; } public List CROSDomainList { get; set; } public WxConfig WxConfig { get; set; } } public class AppSettings { /*public string TemplatePath { get; set; } public string PicturePath { get; set; } public string FilePath { get; set; } public string TemplatePhysicalPath { get { return HttpHelper.MapPath(TemplatePath); } }*/ public string H5BasePath { get; set; } public string H5Version { get; set; } } public class WxConfig { public string AppId { get; set; } public string AppSecret { get; set; } public string RedirectURI { get; set; } } }