1234567891011121314151617181920212223242526272829303132333435363738 |
- using Microsoft.Extensions.Configuration;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Text;
- namespace CZFW.Core
- {
- public class ConfigHelper
- {
- //private static IConfiguration configs;
- public static IConfiguration Configs;
- public static TVal GetValue<TVal>(string key)
- {
- var res = Utility.Parse<TVal>(Configs[key]);
- return res;
- }
- public static string GetCDNPrefix()
- {
- var res = Configs["CDNPrefix"];
- return res;
- }
- //{
- // get
- // {
- // if (configs == null)
- // {
- // var builder = new ConfigurationBuilder()
- // .SetBasePath(Directory.GetCurrentDirectory())
- // .AddJsonFile("appsettings.json", optional: true);
- // configs = builder.Build();
- // }
- // return configs;
- // }
- //}
- }
- }
|