This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<location path="." inheritInChildApplications="false"> | |
<system.webServer> | |
<handlers> | |
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" /> | |
</handlers> | |
<aspNetCore processPath=".\AssemblyName.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" /> | |
<rewrite> | |
<rules> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<location path="." inheritInChildApplications="false"> | |
<system.webServer> | |
<handlers> | |
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" /> | |
</handlers> | |
<aspNetCore processPath=".\Home.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" /> | |
<rewrite> | |
<rules> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AppSettings | |
{ | |
public string AllowedOrigins { get; set; } | |
public string AppName { get; set; } | |
public SubscriptionApi SubscriptionApiSettings { get; set; } | |
public JwtTokenConfig AuthSettings { get; set; } | |
public class JwtTokenConfig | |
{ | |
public string Issuer { get; set; } | |
public string Audience { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SampleController | |
{ | |
public AppSettings settings { get; } | |
public SampleController(IOptions<AppSettings> options), | |
{ | |
settings = options.Value; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AppSettings": { | |
"AppName": "SampleApp", | |
"AllowedOrigins": "https://localhost:6500", | |
"AuthSettings": { | |
"Issuer": "https://domain.com", | |
"Audience": "https://domain.com", | |
"AccessTokenExpiration": 5, | |
"RefreshTokenExpiration": 60 | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private IConfigurationSection SetupConfiguration(IServiceCollection services) | |
{ | |
var environmentName = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); | |
var configuration = new ConfigurationBuilder() | |
.SetBasePath(Directory.GetCurrentDirectory()) | |
.AddJsonFile("appsettings.json", false) | |
.AddJsonFile($"appsettings.{environmentName}.json", true) | |
.AddEnvironmentVariables() | |
.Build(); | |
var appSettingsSection = configuration.GetSection("AppSettings"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
IConfigurationSection appSettingsSection = SetupConfiguration(services); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AppSecrets | |
{ | |
public JwtTokenConfig AuthSecrets { get; set; } | |
public SendGrid SendGridSecrets { get; set; } | |
public Connections ConnectionStrings { get; set; } | |
public Google GoogleSecrets { get; set; } | |
public class Google | |
{ | |
public string CaptchaVerificationSecret { get; set; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EmailSender | |
{ | |
private readonly IConfiguration configuration; | |
public EmailSender(IConfiguration configuration) | |
{ | |
this.configuration = configuration; | |
} | |
public async Task SendEmailAsync() | |
{ | |
var sendGridApiKey = configuration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AppSecrets": { | |
"AuthSecrets": { | |
"Secret": "jskhdg******vkjdsfhvb" | |
}, | |
"SendGridSecrets": { | |
"ApiKey": "kdfhvli******fghvb" | |
}, | |
"ConnectionStrings": { | |
"DbConnectionString": "Server = .\MSSQLServer01; Database=****; Trusted_Connection=True; MultipleActiveResultSets=True" |