Skip to content

Commit

Permalink
refactor(opensearch): rename module to OpenSearchLogging
Browse files Browse the repository at this point in the history
  • Loading branch information
pogromistik committed Jun 18, 2024
1 parent d099248 commit 8ed0e5b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
24 changes: 12 additions & 12 deletions src/Sitko.Core.OpenSearch/ApplicationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ namespace Sitko.Core.OpenSearch;
[PublicAPI]
public static class ApplicationExtensions
{
public static IHostApplicationBuilder AddOpenSearch(this IHostApplicationBuilder hostApplicationBuilder,
Action<IApplicationContext, OpenSearchModuleOptions> configure, string? optionsKey = null)
public static IHostApplicationBuilder AddOpenSearchLogging(this IHostApplicationBuilder hostApplicationBuilder,
Action<IApplicationContext, OpenSearchLoggingModuleOptions> configure, string? optionsKey = null)
{
hostApplicationBuilder.GetSitkoCore().AddOpenSearch(configure, optionsKey);
hostApplicationBuilder.GetSitkoCore().AddOpenSearchLogging(configure, optionsKey);
return hostApplicationBuilder;
}

public static IHostApplicationBuilder AddOpenSearch(this IHostApplicationBuilder hostApplicationBuilder,
Action<OpenSearchModuleOptions>? configure = null, string? optionsKey = null)
public static IHostApplicationBuilder AddOpenSearchLogging(this IHostApplicationBuilder hostApplicationBuilder,
Action<OpenSearchLoggingModuleOptions>? configure = null, string? optionsKey = null)
{
hostApplicationBuilder.GetSitkoCore().AddOpenSearch(configure, optionsKey);
hostApplicationBuilder.GetSitkoCore().AddOpenSearchLogging(configure, optionsKey);
return hostApplicationBuilder;
}

public static ISitkoCoreApplicationBuilder AddOpenSearch(this ISitkoCoreApplicationBuilder applicationBuilder,
Action<IApplicationContext, OpenSearchModuleOptions> configure, string? optionsKey = null) =>
applicationBuilder.AddModule<OpenSearchModule, OpenSearchModuleOptions>(configure, optionsKey);
public static ISitkoCoreApplicationBuilder AddOpenSearchLogging(this ISitkoCoreApplicationBuilder applicationBuilder,
Action<IApplicationContext, OpenSearchLoggingModuleOptions> configure, string? optionsKey = null) =>
applicationBuilder.AddModule<OpenSearchLoggingModule, OpenSearchLoggingModuleOptions>(configure, optionsKey);

public static ISitkoCoreApplicationBuilder AddOpenSearch(this ISitkoCoreApplicationBuilder applicationBuilder,
Action<OpenSearchModuleOptions>? configure = null, string? optionsKey = null) =>
applicationBuilder.AddModule<OpenSearchModule, OpenSearchModuleOptions>(configure, optionsKey);
public static ISitkoCoreApplicationBuilder AddOpenSearchLogging(this ISitkoCoreApplicationBuilder applicationBuilder,
Action<OpenSearchLoggingModuleOptions>? configure = null, string? optionsKey = null) =>
applicationBuilder.AddModule<OpenSearchLoggingModule, OpenSearchLoggingModuleOptions>(configure, optionsKey);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

namespace Sitko.Core.OpenSearch;

public class OpenSearchModule : BaseApplicationModule<OpenSearchModuleOptions>, ILoggingModule<OpenSearchModuleOptions>
public class OpenSearchLoggingModule : BaseApplicationModule<OpenSearchLoggingModuleOptions>, ILoggingModule<OpenSearchLoggingModuleOptions>
{
public override string OptionsKey => "OpenSearch";

public LoggerConfiguration ConfigureLogging(IApplicationContext context, OpenSearchModuleOptions options,
public LoggerConfiguration ConfigureLogging(IApplicationContext context, OpenSearchLoggingModuleOptions options,
LoggerConfiguration loggerConfiguration)
{
if (options.LoggingEnabled)
Expand Down
6 changes: 3 additions & 3 deletions src/Sitko.Core.OpenSearch/OpenSearchModuleConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Sitko.Core.OpenSearch;

public class OpenSearchModuleOptions : BaseModuleOptions
public class OpenSearchLoggingModuleOptions : BaseModuleOptions
{
public bool LoggingEnabled => !string.IsNullOrEmpty(Url);
public string Url { get; set; } = "";
Expand All @@ -24,9 +24,9 @@ public class OpenSearchModuleOptions : BaseModuleOptions
public string? LogIndexTypeName { get; set; }
}

public class OpenSearchModuleOptionsValidator : AbstractValidator<OpenSearchModuleOptions>
public class OpenSearchLoggingModuleOptionsValidator : AbstractValidator<OpenSearchLoggingModuleOptions>
{
public OpenSearchModuleOptionsValidator()
public OpenSearchLoggingModuleOptionsValidator()
{
RuleFor(o => o.Url).NotEmpty().When(o => o.LoggingEnabled)
.WithMessage("OpenSearch url can't be empty");
Expand Down

0 comments on commit 8ed0e5b

Please sign in to comment.