Skip to content

Instantly share code, notes, and snippets.

@tonysneed
Created December 16, 2018 15:52
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tonysneed/a661ef4f5b6236f52c128922ea7217bd to your computer and use it in GitHub Desktop.
ConfigurationService
public class ConfigurationService : IConfigurationService
{
public IEnvironmentService EnvService { get; }
public ConfigurationService(IEnvironmentService envService)
{
EnvService = envService;
}
public IConfiguration GetConfiguration()
{
return new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{EnvService.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables()
.Build();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment