Skip to content

Commit

Permalink
updated standalone
Browse files Browse the repository at this point in the history
  • Loading branch information
HaikAsatryan committed Aug 26, 2024
1 parent cf8f794 commit dcc0f56
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Pandatech.VerticalSlices.SharedKernel.Helpers;
using Pandatech.ModularMonolith.SharedKernel.Helpers;

namespace Pandatech.ModularMonolith.ApiGateway.Extensions;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Microsoft.AspNetCore.Builder;
using Pandatech.Crypto;
using Pandatech.ModularMonolith.SharedKernel.Helpers;
using Pandatech.VerticalSlices.SharedKernel.Helpers;

namespace Pandatech.ModularMonolith.SharedKernel.Extensions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Pandatech.ModularMonolith.SharedKernel.Helpers;
using Pandatech.VerticalSlices.SharedKernel.Helpers;

namespace Pandatech.ModularMonolith.SharedKernel.Extensions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Pandatech.VerticalSlices.SharedKernel.Helpers;
using Pandatech.ModularMonolith.SharedKernel.Helpers;
using Serilog;
using Serilog.Events;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Pandatech.ModularMonolith.SharedKernel.Helpers;
using Pandatech.VerticalSlices.SharedKernel.Helpers;
using RabbitMQ.Client;

namespace Pandatech.ModularMonolith.SharedKernel.Extensions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
using Microsoft.Extensions.Configuration;

namespace Pandatech.VerticalSlices.SharedKernel.Helpers;
namespace Pandatech.ModularMonolith.SharedKernel.Helpers;

public static class ConfigurationHelper
{
private const string AesKey = "Security:AESKey";
private const string RedisUrl = "Redis";
private const string RabbitMqUrl = "RabbitMq";
private const string CorsOrigins = "Security:AllowedCorsOrigins";
private const string HangfireUser = "Security:Hangfire:Username";
private const string HangfirePassword = "Security:Hangfire:Password";
private const string SuperUsername = "Security:SuperUser:Username";
private const string SuperUserPassword = "Security:SuperUser:Password";
private const string AesKeyConfigurationPath = "Security:AESKey";
private const string RedisConfigurationPath = "Redis";
private const string RabbitMqConfigurationPath = "RabbitMq";
private const string PostgresConfigurationPath = "Postgres";
private const string CorsOriginsConfigurationPath = "Security:AllowedCorsOrigins";
private const string HangfireUserConfigurationPath = "Security:Hangfire:Username";
private const string HangfirePasswordConfigurationPath = "Security:Hangfire:Password";
private const string SuperUsernameConfigurationPath = "Security:SuperUser:Username";
private const string SuperUserPasswordConfigurationPath = "Security:SuperUser:Password";
private const string PersistentConfigurationPath = "PersistentStorage";
private const string RepositoryNameConfigurationPath = "RepositoryName";

public static string GetFileStoragePath(this IConfiguration configuration)
{
var persistencePath = configuration.GetPersistentPath();
return $"{persistencePath}/files";
}

public static string GetRepositoryName(this IConfiguration configuration)
{
Expand All @@ -27,42 +34,46 @@ public static string GetPersistentPath(this IConfiguration configuration)

public static string GetAesKey(this IConfiguration configuration)
{
return configuration[AesKey]!;
return configuration[AesKeyConfigurationPath]!;
}

public static string GetRedisUrl(this IConfiguration configuration)
{
return configuration.GetConnectionString(RedisUrl)!;
return configuration.GetConnectionString(RedisConfigurationPath)!;
}

public static string GetRabbitMqUrl(this IConfiguration configuration)
{
return configuration.GetConnectionString(RabbitMqUrl)!;
return configuration.GetConnectionString(RabbitMqConfigurationPath)!;
}

public static string GetPostgresUrl(this IConfiguration configuration)
{
return configuration.GetConnectionString(PostgresConfigurationPath)!;
}


public static string GetAllowedCorsOrigins(this IConfiguration configuration)
{
return configuration[CorsOrigins]!;
return configuration[CorsOriginsConfigurationPath]!;
}

public static string GetHangfireUsername(this IConfiguration configuration)
{
return configuration[HangfireUser]!;
return configuration[HangfireUserConfigurationPath]!;
}

public static string GetHangfirePassword(this IConfiguration configuration)
{
return configuration[HangfirePassword]!;
return configuration[HangfirePasswordConfigurationPath]!;
}

public static string GetSuperUsername(this IConfiguration configuration)
{
return configuration[SuperUsername]!;
return configuration[SuperUsernameConfigurationPath]!;
}

public static string GetSuperuserPassword(this IConfiguration configuration)
{
return configuration[SuperUserPassword]!;
return configuration[SuperUserPasswordConfigurationPath]!;
}
}

0 comments on commit dcc0f56

Please sign in to comment.