123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- 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<AppSettings>();
- result.CROSDomainList = configuration.GetSection("Web")
- .GetSection("Cros")
- .GetValue<string>("Domain")
- .Split(",", StringSplitOptions.RemoveEmptyEntries)
- .Select(x => x.Trim()).ToList();
- result.WxConfig = configuration.GetSection("WxConfig").Get<WxConfig>();
- return result;
- }
- }
- public AppSettings AppSettings { get; set; }
- public List<string> 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; }
- }
- }
|