1234567891011121314151617181920212223242526 |
- using Microsoft.Extensions.Configuration;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Text;
- namespace Bowin.Common.Utility
- {
- public class Environment
- {
- public static IConfigurationRoot GetConfig(string configFileName)
- {
- var basePath = Directory.GetCurrentDirectory();
- if (!File.Exists(Path.Combine(basePath, configFileName)))
- {
- basePath = AppDomain.CurrentDomain.BaseDirectory;
- }
- return new ConfigurationBuilder()
- .SetBasePath(basePath)
- .AddJsonFile(configFileName)
- .Build();
- }
- }
- }
|