55using HamEvent ;
66using HamEvent . Data ;
77using HamEvent . Services ;
8- using Microsoft . AspNetCore . Builder ;
9- using Microsoft . AspNetCore . Hosting ;
108using Microsoft . EntityFrameworkCore ;
11- using Microsoft . Extensions . Configuration ;
129using NReco . Logging . File ;
10+ using System . Configuration ;
1311using System . Net ;
14- using System . Net . Mail ;
1512
1613
1714var builder = WebApplication . CreateBuilder ( args ) ;
2118builder . Services . AddScoped < ICoreMvcMailer , CoreMvcMailer > ( ) ;
2219builder . Services . AddRazorPages ( ) ;
2320builder . Services . AddControllersWithViews ( ) ;
24- builder . Services . AddAutoMapper ( AppDomain . CurrentDomain . GetAssemblies ( ) ) ;
25- var tokenSecret = builder . Configuration [ "Token:Secret" ] ?? throw new ArgumentNullException ( "Token:Secret" , "Token secret is not configured." ) ;
21+ builder . Services . AddAutoMapper ( cfg => { } , AppDomain . CurrentDomain . GetAssemblies ( ) ) ;
22+ var tokenSecret = builder . Configuration [ "Token:Secret" ] ?? throw new ConfigurationErrorsException ( "Token secret is not configured." ) ;
2623
2724builder . Services . AddSingleton < TokenService > ( provider => new TokenService ( tokenSecret ) ) ;
2825
3936{
4037 options . Filters . Add ( new MyElmahFilter ( ) ) ;
4138 options . OnPermissionCheck = context => wl . Whitelist
42- . Where ( ip => IPAddress . Parse ( ip )
43- . Equals ( context . Connection . RemoteIpAddress ) )
44- . Any ( ) ;
39+ . Any ( ip => IPAddress . Parse ( ip )
40+ . Equals ( context . Connection . RemoteIpAddress ) ) ;
4541 options . LogPath = "~/log" ;
4642} ) ;
4743builder . Services . AddLogging ( loggingBuilder => {
7066app . MapFallbackToFile ( "index.html" ) ;
7167app . UseElmah ( ) ;
7268app . Run ( ) ;
73-
74-
75- public class MailerSettings
76- {
77- public string From { get ; set ; } = String . Empty ;
78- public string Username { get ; set ; } = String . Empty ;
79- public string Password { get ; set ; } = String . Empty ;
80- public string Host { get ; set ; } = String . Empty ;
81- public short Port { get ; set ; }
82- public Boolean EnableSSL { get ; set ; }
83- }
0 commit comments