File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88using Microsoft . AspNetCore . Authorization ;
99using Microsoft . AspNetCore . Mvc ;
1010using Microsoft . Data . Sqlite ;
11+ using Microsoft . Extensions . Configuration . AzureAppConfiguration ;
1112using SnooBrowser . Extensions . DependencyInjection ;
1213using Swashbuckle . AspNetCore . SwaggerUI ;
1314using WebApi . AuthHandlers ;
1617
1718var builder = WebApplication . CreateBuilder ( args ) ;
1819
20+ const string PROJECT_ID = "ACM" ;
21+
1922// Add services to the container.
23+ builder . Configuration . AddAzureAppConfiguration ( options =>
24+ {
25+ var azureAppConfigConnectionString = builder . Configuration . GetConnectionString ( "AzureAppConfig" ) ;
26+ options . Connect ( azureAppConfigConnectionString )
27+ . Select ( keyFilter : $ "{ PROJECT_ID } _*")
28+ . Select ( keyFilter : $ "{ PROJECT_ID } _*", labelFilter : builder . Environment . EnvironmentName )
29+ . ConfigureRefresh ( x => x . SetCacheExpiration ( TimeSpan . FromDays ( 1 ) ) ) ;
30+ } ) ;
31+
2032ConfigureServices ( builder . Services , builder . Configuration ) ;
2133ConfigureDataAccess ( builder . Services , builder . Configuration ) ;
2234
Original file line number Diff line number Diff line change 1- <Project Sdk =" Microsoft.NET.Sdk.Web" >
1+ <Project Sdk =" Microsoft.NET.Sdk.Web" >
22
33 <PropertyGroup >
44 <TargetFramework >net7.0</TargetFramework >
55 <Nullable >enable</Nullable >
66 <ImplicitUsings >enable</ImplicitUsings >
77 <LangVersion >11</LangVersion >
88 <Version >2.2.0</Version >
9+ <UserSecretsId >33502323-e6f7-405a-897c-fd75a7a25b54</UserSecretsId >
910 </PropertyGroup >
1011
1112 <PropertyGroup Condition =" '$(Configuration)' == 'Debug' " >
1819
1920 <ItemGroup >
2021 <PackageReference Include =" Microsoft.Data.Sqlite" Version =" 7.0.16" />
22+ <PackageReference Include =" Microsoft.Extensions.Configuration.AzureAppConfiguration" Version =" 7.1.0" />
2123 <PackageReference Include =" SnooBrowser.Extensions.DependencyInjection" Version =" 3.0.4" />
2224 <PackageReference Include =" Swashbuckle.AspNetCore" Version =" 6.4.0" />
2325 <PackageReference Include =" Swashbuckle.AspNetCore.Annotations" Version =" 6.4.0" />
Original file line number Diff line number Diff line change 99 "ConnectionStrings" : {
1010 "DbConnection" : " "
1111 },
12- "DbSettings" : {
13- "HostName" : " 127.0.0.1" ,
14- "DatabaseName" : " " ,
15- "Username" : " " ,
16- "Password" : " "
17- },
1812 "RedditSettings" : {
1913 "AppId" : " " ,
2014 "AppSecret" : " " ,
You can’t perform that action at this time.
0 commit comments