Skip to content

Commit

Permalink
Added AppSettings in IOptions DI
Browse files Browse the repository at this point in the history
  • Loading branch information
panosru committed Feb 20, 2024
1 parent 0419c10 commit 1231a8e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Domains/Shared/Core/AppSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace CleanDDDArchitecture.Domains.Shared.Core;

public class AppSettings
{
public string Title { get; set; }
public Dictionary<string, string> SocialMedia { get; set; }
public LegalSettings Legal { get; set; }
public string BaseUrl { get; set; }
public EmailSettings Emails { get; set; }

public class LegalSettings
{
public string TermsOfService { get; set; }
public string PrivacyPolicy { get; set; }
}

public class EmailSettings
{
public string Contact { get; set; }
public string NoReply { get; set; }
}
}
5 changes: 5 additions & 0 deletions Hosts/RestApi/Presentation/ServiceConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Aviant.Infrastructure.CrossCutting;
using CleanDDDArchitecture.Domains.Shared.Core;
using CleanDDDArchitecture.Hosts.RestApi.Presentation.ServiceExtensions;

namespace CleanDDDArchitecture.Hosts.RestApi.Presentation;
Expand All @@ -21,6 +22,10 @@ public static void ConfigureServices(
{
services.AddSingleton(configuration);
DependencyInjectionRegistry.CurrentEnvironment = environment;

// Bind App Settings
var appSettings = configuration.GetSection("AppSettings");
services.Configure<AppSettings>(appSettings);

services.AddEmailService(configuration);
services.AddAutoMapperServices();
Expand Down

0 comments on commit 1231a8e

Please sign in to comment.