Skip to content

Commit 49ed6d8

Browse files
authored
Added host.json when using UseAppSettings extension to be used by Azure Functions settings (#7)
* Adding exception to not publish when there is a documentation change. * Fix deploy workflow * Update packages, add host.json to configuration.
1 parent 2effd3a commit 49ed6d8

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

Autofac.Extensions.DependencyInjection.AzureFunctions/Autofac.Extensions.DependencyInjection.AzureFunctions.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<ItemGroup>
3333
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="6.0.0" />
3434
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" />
35-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.2" />
35+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.8" />
3636
</ItemGroup>
3737

3838
<ItemGroup>

Autofac.Extensions.DependencyInjection.AzureFunctions/ConfigurationExtensions.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,18 @@ public static IFunctionsHostBuilder UseAppSettings(this IFunctionsHostBuilder ho
6262
string currentDirectory = fileInfo.Directory.Parent.FullName;
6363

6464
var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
65-
if (string.IsNullOrWhiteSpace(environment)) environment = "Development";
65+
if (string.IsNullOrWhiteSpace(environment))
66+
environment = Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT");
67+
if (string.IsNullOrWhiteSpace(environment))
68+
environment = "Development"; // Fallback to Development when none is set.
6669

6770
return UseAppSettings(hostBuilder, (builder) =>
6871
{
6972
builder
7073
.SetBasePath(currentDirectory)
7174
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
7275
.AddJsonFile($"appsettings.{environment}.json", optional: true, reloadOnChange: true)
76+
.AddJsonFile("host.json", optional: true, reloadOnChange: true)
7377
.AddEnvironmentVariables();
7478
});
7579
}

SampleAutofacFunction/SampleAutofacFunction.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="3.0.10" />
8-
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.3" />
7+
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="4.0.2" />
8+
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.9" />
99
</ItemGroup>
1010
<ItemGroup>
1111
<ProjectReference Include="..\Autofac.Extensions.DependencyInjection.AzureFunctions\Autofac.Extensions.DependencyInjection.AzureFunctions.csproj" />

SampleAutofacFunction/host.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
"isEnabled": true
88
}
99
}
10-
}
10+
},
11+
"functionTimeout": "00:10:00"
1112
}

autofac-azurefunctions.sln

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1111
ProjectSection(SolutionItems) = preProject
1212
.gitignore = .gitignore
1313
LICENSE = LICENSE
14+
.github\workflows\main.yml = .github\workflows\main.yml
1415
README.md = README.md
1516
EndProjectSection
1617
EndProject

0 commit comments

Comments
 (0)