Skip to content

Commit 37becbe

Browse files
committed
Revert "get rid of fu.functions"
This reverts commit 956f126.
1 parent 956f126 commit 37becbe

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
2+
# More GitHub Actions for Azure: https://github.com/Azure/actions
3+
4+
name: Build and deploy dotnet core app to Azure Function App - fujobfunctions
5+
6+
on:
7+
push:
8+
branches:
9+
- expiredPosts
10+
workflow_dispatch:
11+
12+
env:
13+
AZURE_FUNCTIONAPP_PACKAGE_PATH: './FU.API/FU.Functions' # set this to the path to your web app project, defaults to the repository root
14+
DOTNET_VERSION: '7.0.x' # set this to the dotnet version to use
15+
16+
jobs:
17+
build-and-deploy:
18+
runs-on: windows-latest
19+
steps:
20+
- name: 'Checkout GitHub Action'
21+
uses: actions/checkout@v4
22+
23+
- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
24+
uses: actions/setup-dotnet@v1
25+
with:
26+
dotnet-version: ${{ env.DOTNET_VERSION }}
27+
28+
- name: 'Resolve Project Dependencies Using Dotnet'
29+
shell: pwsh
30+
run: |
31+
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
32+
dotnet build --configuration Release --output ./output
33+
popd
34+
35+
- name: 'Run Azure Functions Action'
36+
uses: Azure/functions-action@v1
37+
id: fa
38+
with:
39+
app-name: 'fujobfunctions'
40+
slot-name: 'Production'
41+
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
42+
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_EBF4023DFD76450CB68EFF47B278296C }}

FU.API/FU.API.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1212
EndProject
1313
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FU.API.Tests", "FU.API.Tests\FU.API.Tests.csproj", "{EECF8E74-3D21-449F-92A9-B3A77B784ADD}"
1414
EndProject
15+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FU.Functions", "FU.Functions\FU.Functions.csproj", "{F4C24459-5A6B-4858-B9B9-1AF9F0CF6CED}"
16+
EndProject
1517
Global
1618
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1719
Debug|Any CPU = Debug|Any CPU
@@ -26,6 +28,10 @@ Global
2628
{EECF8E74-3D21-449F-92A9-B3A77B784ADD}.Debug|Any CPU.Build.0 = Debug|Any CPU
2729
{EECF8E74-3D21-449F-92A9-B3A77B784ADD}.Release|Any CPU.ActiveCfg = Release|Any CPU
2830
{EECF8E74-3D21-449F-92A9-B3A77B784ADD}.Release|Any CPU.Build.0 = Release|Any CPU
31+
{F4C24459-5A6B-4858-B9B9-1AF9F0CF6CED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
32+
{F4C24459-5A6B-4858-B9B9-1AF9F0CF6CED}.Debug|Any CPU.Build.0 = Debug|Any CPU
33+
{F4C24459-5A6B-4858-B9B9-1AF9F0CF6CED}.Release|Any CPU.ActiveCfg = Release|Any CPU
34+
{F4C24459-5A6B-4858-B9B9-1AF9F0CF6CED}.Release|Any CPU.Build.0 = Release|Any CPU
2935
EndGlobalSection
3036
GlobalSection(SolutionProperties) = preSolution
3137
HideSolutionNode = FALSE

FU.API/FU.API/Data/ContextFactory.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,17 @@ public static AppDbContext CreateDbContext()
2424

2525
return new AppDbContext(optionsBuilder.Options);
2626
}
27+
28+
public static AppDbContext CreateDbContext(IConfiguration configuration)
29+
{
30+
if (configuration is null)
31+
{
32+
throw new InvalidOperationException("Configuration has not been set.");
33+
}
34+
35+
var optionsBuilder = new DbContextOptionsBuilder<AppDbContext>();
36+
optionsBuilder.UseNpgsql(configuration[ConfigKey.ConnectionString]);
37+
38+
return new AppDbContext(optionsBuilder.Options);
39+
}
2740
}

0 commit comments

Comments
 (0)