1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- 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 H5Version { get; set; }
- }
- public class WxConfig
- {
- public string AppId { get; set; }
- public string AppSecret { get; set; }
- public string RedirectURI { get; set; }
- }
- }
|