Add configurations and update packages
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using GerstITS.Examples.Api.Configurations;
|
||||
using GerstITS.System.Configurations;
|
||||
using GerstITS.Web.Api.Builder;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace BakeTronic.Web.Api.Configurations
|
||||
{
|
||||
internal sealed class ServerConfiguration : IServerConfiguration
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
public ServerConfiguration(string parentPrefix, Microsoft.Extensions.Configuration.IConfiguration configuration)
|
||||
{
|
||||
var prefix = $"{parentPrefix}:{this.ToConfigurationPrefix()}";
|
||||
|
||||
UseHttpsRedirection = configuration.GetValue<bool>($"{prefix}:{nameof(UseHttpsRedirection)}");
|
||||
UseHsts = configuration.GetValue<bool>($"{prefix}:{nameof(UseHsts)}");
|
||||
UseCors = configuration.GetValue<bool>($"{prefix}:{nameof(UseCors)}");
|
||||
|
||||
Headers = new WebApiHeadersConfiguration(prefix, configuration);
|
||||
CorsPolicy = new CorsPolicyConfiguration(prefix, configuration);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IServerConfiguration
|
||||
|
||||
public bool UseHttpsRedirection { get; }
|
||||
public bool UseHsts { get; }
|
||||
public bool UseCors { get; }
|
||||
public IHeaderConfiguration Headers { get; }
|
||||
public ICorsPolicy CorsPolicy { get; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user