Add project files.
This commit is contained in:
		| @@ -0,0 +1,48 @@ | ||||
| using Core.Blueprint.External; | ||||
| using Microsoft.Extensions.Configuration; | ||||
|  | ||||
| namespace Core.Cerberos.External.GatewayConfigurations | ||||
| { | ||||
|     public class GatewaySettingsConfigurations | ||||
|     { | ||||
|         private static GatewayConfiguration GatewayConfigurations { get; set; } = new GatewayConfiguration(); | ||||
|         private readonly IConfiguration _configuration; | ||||
|  | ||||
|         public GatewaySettingsConfigurations(IConfiguration configuration) | ||||
|         { | ||||
|             _configuration = configuration; | ||||
|             this.SetCerberosServiceAPIEndpoint(); | ||||
|         } | ||||
|         public static CerberosServiceAPI GetCerberosServiceAPIEndpoint() | ||||
|         { | ||||
|             return GatewayConfigurations.CerberosService; | ||||
|         } | ||||
|         private GatewayConfiguration SetCerberosServiceAPIEndpoint() | ||||
|         { | ||||
|             IConfigurationSection source; | ||||
|             var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? string.Empty; | ||||
|  | ||||
|             if (environment == "Local") | ||||
|                 source = _configuration.GetSection("LocalGateways"); | ||||
|             else | ||||
|                 source = _configuration.GetSection("Gateways"); | ||||
|  | ||||
|             var endpoint = source["CerberosDAL"] ?? string.Empty; | ||||
|  | ||||
|             if (string.IsNullOrEmpty(endpoint)) throw new Exception("Cerberos DAL endpoint is empty or null"); | ||||
|  | ||||
|             GatewayConfigurations.CerberosService = new CerberosServiceAPI() | ||||
|             { | ||||
|                 Endpoint = new BaseEndpoint() | ||||
|                 { | ||||
|                     Uri = new Uri(endpoint), | ||||
|                     Url = endpoint, | ||||
|                     Token = string.Empty, | ||||
|                     APIName = "Cerberos Service" | ||||
|                 } | ||||
|             }; | ||||
|  | ||||
|             return GatewayConfigurations; | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Sergio Matias Urquin
					Sergio Matias Urquin