Merge pull request #142 from chlowell/hosting-changes
Set application discriminators, work around Redis client issue
This commit is contained in:
commit
d652c4027c
@ -94,13 +94,21 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Model
|
|||||||
|
|
||||||
private async Task ConnectToRedisAsync()
|
private async Task ConnectToRedisAsync()
|
||||||
{
|
{
|
||||||
//TODO: Need to make this more robust. Also want to understand why the static connection method cannot accept dns names.
|
// TODO: Need to make this more robust. ConnectionMultiplexer.ConnectAsync doesn't like domain names or IPv6 addresses.
|
||||||
var ips = await Dns.GetHostAddressesAsync(_settings.ConnectionString);
|
if (IPAddress.TryParse(_settings.ConnectionString, out var ip))
|
||||||
_logger.LogInformation($"Connecting to database {_settings.ConnectionString} at IP {ips.First().ToString()}");
|
{
|
||||||
_redis = await ConnectionMultiplexer.ConnectAsync(ips.First().ToString());
|
_redis = await ConnectionMultiplexer.ConnectAsync(ip.ToString());
|
||||||
|
_logger.LogInformation($"Connecting to database at {_settings.ConnectionString}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// workaround for https://github.com/StackExchange/StackExchange.Redis/issues/410
|
||||||
|
var ips = await Dns.GetHostAddressesAsync(_settings.ConnectionString);
|
||||||
|
_logger.LogInformation($"Connecting to database {_settings.ConnectionString} at IP {ips.First().ToString()}");
|
||||||
|
_redis = await ConnectionMultiplexer.ConnectAsync(ips.First().ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +57,11 @@ namespace eShopOnContainers.Identity
|
|||||||
|
|
||||||
services.Configure<AppSettings>(Configuration);
|
services.Configure<AppSettings>(Configuration);
|
||||||
|
|
||||||
|
services.AddDataProtection(opts =>
|
||||||
|
{
|
||||||
|
opts.ApplicationDiscriminator = "eshop.identity";
|
||||||
|
});
|
||||||
|
|
||||||
services.AddMvc();
|
services.AddMvc();
|
||||||
|
|
||||||
services.AddHealthChecks(checks =>
|
services.AddHealthChecks(checks =>
|
||||||
|
@ -44,6 +44,11 @@ namespace Microsoft.eShopOnContainers.WebMVC
|
|||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
|
services.AddDataProtection(opts =>
|
||||||
|
{
|
||||||
|
opts.ApplicationDiscriminator = "eshop.webmvc";
|
||||||
|
});
|
||||||
|
|
||||||
services.AddMvc();
|
services.AddMvc();
|
||||||
services.Configure<AppSettings>(Configuration);
|
services.Configure<AppSettings>(Configuration);
|
||||||
|
|
||||||
|
@ -51,6 +51,11 @@ namespace eShopConContainers.WebSPA
|
|||||||
|
|
||||||
services.Configure<AppSettings>(Configuration);
|
services.Configure<AppSettings>(Configuration);
|
||||||
|
|
||||||
|
services.AddDataProtection(opts =>
|
||||||
|
{
|
||||||
|
opts.ApplicationDiscriminator = "eshop.webspa";
|
||||||
|
});
|
||||||
|
|
||||||
services.AddAntiforgery(options => options.HeaderName = "X-XSRF-TOKEN");
|
services.AddAntiforgery(options => options.HeaderName = "X-XSRF-TOKEN");
|
||||||
|
|
||||||
services.AddMvc()
|
services.AddMvc()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user