public async Task InitializeAsync() { _provider = new GoogleGeoCoderProvider(); var container = Resolver.Resolve <IDependencyContainer>(); container.Register <IGeoCoderProvider>(t => _provider); Invisionware.Net.GeoCoding.ModelMapper.Map(); _provider.Initialize(coderProvider => { coderProvider.APIKey = "AIzaSyC6J16WxOGEnOzFzMiYnq6pDIMpLjHCSbI"; //coderProvider.APIKey = "AIzaSyAMXZ764BOsGdo8RFXsWTneMYows3zdmrg"; }); }
public Task InitializeAsync() { var config = new Microsoft.Extensions.Configuration.ConfigurationBuilder() .AddJsonFile("appsettings.json", true, true) .AddJsonFile("appsettings.dev.json", true, true) // This is used for local work so API key is not added to git .AddEnvironmentVariables() // THis is used for AzureDevops .Build(); _provider = new GoogleGeoCoderProvider(); var container = Resolver.Resolve <IDependencyContainer>(); container.Register <IGeoCoderProvider>(t => _provider); _provider.Initialize(coderProvider => { coderProvider.APIKey = config["googleApiKey"]; }); return(Task.FromResult(true)); }