-
-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(templates): improve Boilerplate forwarded headers middleware con…
- Loading branch information
Showing
8 changed files
with
40 additions
and
50 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,7 @@ | |
# Project templates come equipped with CI/CD for both Azure DevOps and GitHub, providing you with a hassle-free way to get started with your new project. It is important to note that you should not depend on the contents of this file. More info at https://bitplatform.dev/templates/dev-ops | ||
|
||
env: | ||
API_SERVER_ADDRESS: 'https://adminpanel-api.bitplatform.dev' | ||
WEB_SERVER_ADDRESS: 'https://adminpanel.bitplatform.dev' | ||
SERVER_ADDRESS: 'https://adminpanel.bitplatform.dev' | ||
APP_SERVICE_NAME: 'bit-adminpanel' | ||
|
||
on: | ||
|
@@ -36,15 +35,15 @@ jobs: | |
cd src/Templates/Boilerplate && dotnet build -c Release | ||
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 | ||
dotnet new install Bit.Boilerplate.0.0.0.nupkg | ||
cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --sentry --serverUrl ${{ env.WEB_SERVER_ADDRESS }} --filesStorage AzureBlobStorage --api Standalone --notification --captcha reCaptcha --signalR --framework net9.0 | ||
cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --sentry --serverUrl ${{ env.SERVER_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --framework net9.0 | ||
- name: Update core appsettings.json | ||
uses: devops-actions/[email protected] | ||
with: | ||
files: 'AdminPanel/src/Shared/appsettings.json, AdminPanel/src/Client/AdminPanel.Client.Core/appsettings.json, AdminPanel/src/Client/AdminPanel.Client.Web/appsettings.json, AdminPanel/src/Client/AdminPanel.Client.Web/appsettings.Production.json' | ||
env: | ||
WebAppRender.BlazorMode: BlazorWebAssembly | ||
ServerAddress: ${{ env.API_SERVER_ADDRESS }} | ||
ServerAddress: ${{ env.SERVER_ADDRESS }} | ||
Logging.Sentry.Dsn: ${{ secrets.ADMINPANEL_SENTRY_DSN }} | ||
GoogleRecaptchaSiteKey: ${{ secrets.GOOGLE_RECAPTCHA_SITE_KEY }} | ||
AdsPushVapid.PublicKey: ${{ secrets.ADMINPANEL_PUBLIC_VAPIDKEY }} | ||
|
@@ -61,24 +60,13 @@ jobs: | |
run: dotnet build AdminPanel/src/Client/AdminPanel.Client.Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" --no-restore -c Release | ||
|
||
- name: Publish | ||
run: dotnet publish AdminPanel/src/Server/AdminPanel.Server.Api/AdminPanel.Server.Api.csproj -c Release -p:PwaEnabled=true --self-contained -r linux-x64 -o ${{env.DOTNET_ROOT}}/server -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" | ||
run: dotnet publish AdminPanel/src/Server/AdminPanel.Server.Web/AdminPanel.Server.Web.csproj -c Release -p:PwaEnabled=true --self-contained -r linux-x64 -o ${{env.DOTNET_ROOT}}/server -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" | ||
|
||
- name: Upload server artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: server-bundle | ||
path: ${{env.DOTNET_ROOT}}/server | ||
|
||
- name: Publish adminpanel blazor wasm standalone | ||
run: | | ||
sed -i 's/adminpanel.bitplatform.dev/adminpanel-api.bitplatform.dev/g' AdminPanel/src/Client/AdminPanel.Client.Web/wwwroot/index.html | ||
dotnet publish AdminPanel/src/Client/AdminPanel.Client.Web/AdminPanel.Client.Web.csproj -c Release -p:PwaEnabled=true -o ${{env.DOTNET_ROOT}}/static -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" | ||
- name: Upload static artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: static-bundle | ||
path: ${{env.DOTNET_ROOT}}/static | ||
include-hidden-files: true # Required for wwwroot/.well-known folder | ||
|
||
deploy_api_blazor: | ||
|
@@ -145,14 +133,14 @@ jobs: | |
cd src\Templates\Boilerplate && dotnet build -c Release | ||
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 | ||
dotnet new install Bit.Boilerplate.0.0.0.nupkg | ||
cd ..\..\..\ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --windows --appInsights --sentry --serverUrl ${{ env.WEB_SERVER_ADDRESS }} --filesStorage AzureBlobStorage --captcha reCaptcha --signalR --offlineDb --framework net9.0 | ||
cd ..\..\..\ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --windows --appInsights --sentry --serverUrl ${{ env.SERVER_ADDRESS }} --filesStorage AzureBlobStorage --captcha reCaptcha --signalR --offlineDb --framework net9.0 | ||
- name: Update core appsettings.json | ||
uses: devops-actions/[email protected] | ||
with: | ||
files: 'AdminPanel\src\Shared\appsettings.json, AdminPanel\src\Client\AdminPanel.Client.Core\appsettings.json, AdminPanel\src\Client\AdminPanel.Client.Windows\appsettings.json' | ||
env: | ||
ServerAddress: ${{ env.API_SERVER_ADDRESS }} | ||
ServerAddress: ${{ env.SERVER_ADDRESS }} | ||
Logging.Sentry.Dsn: ${{ secrets.ADMINPANEL_SENTRY_DSN }} | ||
GoogleRecaptchaSiteKey: ${{ secrets.GOOGLE_RECAPTCHA_SITE_KEY }} | ||
WindowsUpdate.FilesUrl: https://windows-adminpanel.bitplatform.dev | ||
|
@@ -193,7 +181,7 @@ jobs: | |
cd src/Templates/Boilerplate && dotnet build -c Release | ||
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 | ||
dotnet new install Bit.Boilerplate.0.0.0.nupkg | ||
cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --sentry --serverUrl ${{ env.WEB_SERVER_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --framework net9.0 | ||
cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --sentry --serverUrl ${{ env.SERVER_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --framework net9.0 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
|
@@ -218,7 +206,7 @@ jobs: | |
with: | ||
files: 'AdminPanel/src/Shared/appsettings.json, AdminPanel/src/Client/AdminPanel.Client.Core/appsettings.json, AdminPanel/src/Client/AdminPanel.Client.Maui/appsettings.json' | ||
env: | ||
ServerAddress: ${{ env.API_SERVER_ADDRESS }} | ||
ServerAddress: ${{ env.SERVER_ADDRESS }} | ||
Logging.Sentry.Dsn: ${{ secrets.ADMINPANEL_SENTRY_DSN }} | ||
GoogleRecaptchaSiteKey: ${{ secrets.GOOGLE_RECAPTCHA_SITE_KEY }} | ||
ApplicationInsights.ConnectionString: ${{ secrets.APPLICATION_INSIGHTS_CONNECTION_STRING }} | ||
|
@@ -270,14 +258,14 @@ jobs: | |
cd src/Templates/Boilerplate && dotnet build -c Release | ||
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 | ||
dotnet new install Bit.Boilerplate.0.0.0.nupkg | ||
cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --serverUrl ${{ env.WEB_SERVER_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --framework net9.0 | ||
cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --serverUrl ${{ env.SERVER_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --framework net9.0 | ||
- name: Update core appsettings.json | ||
uses: devops-actions/[email protected] | ||
with: | ||
files: 'AdminPanel/src/Shared/appsettings.json, AdminPanel/src/Client/AdminPanel.Client.Core/appsettings.json, AdminPanel/src/Client/AdminPanel.Client.Maui/appsettings.json' | ||
env: | ||
ServerAddress: ${{ env.API_SERVER_ADDRESS }} | ||
ServerAddress: ${{ env.SERVER_ADDRESS }} | ||
Logging.Sentry.Dsn: ${{ secrets.ADMINPANEL_SENTRY_DSN }} | ||
GoogleRecaptchaSiteKey: ${{ secrets.GOOGLE_RECAPTCHA_SITE_KEY }} | ||
ApplicationInsights.ConnectionString: ${{ secrets.APPLICATION_INSIGHTS_CONNECTION_STRING }} | ||
|
This file contains 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
4 changes: 2 additions & 2 deletions
4
...Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/appsettings.Production.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
{ | ||
"WebAppRender": { | ||
"BlazorMode": "BlazorAuto" | ||
"BlazorMode": "BlazorWebAssembly" | ||
}, | ||
"$schema": "https://json.schemastore.org/appsettings.json" | ||
} |
5 changes: 4 additions & 1 deletion
5
...oilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/appsettings.Development.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
{ | ||
{ | ||
"ForwardedHeaders": { | ||
"AllowedHosts": [ "*" ] | ||
}, | ||
"DetailedErrors": true, | ||
"$schema": "https://json.schemastore.org/appsettings.json" | ||
} |
This file contains 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
5 changes: 4 additions & 1 deletion
5
...oilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/appsettings.Development.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
{ | ||
{ | ||
"ForwardedHeaders": { | ||
"AllowedHosts": [ "*" ] | ||
}, | ||
"DetailedErrors": true, | ||
"$schema": "https://json.schemastore.org/appsettings.json" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,19 +3,16 @@ | |
"ConnectionStrings": { | ||
"SqlServerConnectionString": "Data Source=(localdb)\\mssqllocaldb; Initial Catalog=BoilerplateDb;Integrated Security=true;Application Name=Boilerplate;TrustServerCertificate=True;", | ||
"SqliteConnectionString": "Data Source=App_Data/BoilerplateDb.db;", | ||
"SqliteConnectionString_Comment": "To debug inside docker, change ConnectionStrings__SqliteConnectionString's value in launchSettings.json", | ||
"PostgreSQLConnectionString": "User ID=postgres;Password=postgres;Host=localhost;Database=BoilerplateDb;", | ||
"MySqlSQLConnectionString": "Server=localhost;Port=3306;Database=BoilerplateDb;Uid=root;Pwd=123456;", | ||
"AzureBlobStorageSasUrl": "emulator", | ||
"AzureBlobStorageSasUrl_Comment": "More info about blob storage sas url at https://learn.microsoft.com/en-us/azure/ai-services/translator/document-translation/how-to-guides/create-sas-tokens?tabs=blobs#create-sas-tokens-in-the-azure-portal" | ||
"AzureBlobStorageSasUrl": "emulator" | ||
|
||
}, | ||
"DataProtectionCertificatePassword": "P@ssw0rdP@ssw0rd", | ||
"DataProtectionCertificatePassword_Comment": "It can also be configured using: dotnet user-secrets set 'DataProtectionCertificatePassword' 'P@ssw0rdP@ssw0rd'", | ||
"Identity": { | ||
"Issuer": "Boilerplate", | ||
"Audience": "Boilerplate", | ||
"BearerTokenExpiration": "0.00:05:00", | ||
"BearerTokenExpiration_Comment": "BearerTokenExpiration used as JWT's expiration claim, access token's expires in and cookie's max age. Format: D.HH:mm:ss", | ||
"RefreshTokenExpiration": "14.00:00:00", | ||
"EmailTokenLifetime": "0.00:02:00", | ||
"PhoneNumberTokenLifetime": "0.00:02:00", | ||
|
@@ -36,7 +33,6 @@ | |
}, | ||
"Email": { | ||
"Host": "LocalFolder", | ||
"Host_Comment": "Local folder means storing emails as .eml file in App_Data/sent-emails folder (Recommended for testing purposes only) instead of sending them using smtp server.", | ||
"Port": "587", | ||
"DefaultFromEmail": "[email protected]", | ||
"UserName": null, | ||
|
@@ -49,26 +45,18 @@ | |
}, | ||
"UserProfileImagesDir": "attachments/profiles/", | ||
"GoogleRecaptchaSecretKey": "6LdMKr4pAAAAANvngWNam_nlHzEDJ2t6SfV6L_DS", | ||
"AdsPushVapid_Comment": "https://github.com/adessoTurkey-dotNET/AdsPush", | ||
"AdsPushVapid": { | ||
"AdsPushVapid_Comment": "Web push's vapid. More info at https://tools.reactpwa.com/vapid/", | ||
"Subject": "mailto:[email protected]", | ||
"PrivateKey": "dMIR1ICj-lDWYZ-ZYCwXKyC2ShYayYYkEL-oOPnpq9c", | ||
"PublicKey_Comment": "Set public key in Client.Core's appsettings.json" | ||
"PrivateKey": "dMIR1ICj-lDWYZ-ZYCwXKyC2ShYayYYkEL-oOPnpq9c" | ||
}, | ||
"AdsPushAPNS": { | ||
"P8PrivateKey": null, | ||
"P8PrivateKey_Comment": "p8 certificate string without spaces and start/end tags.", | ||
"P8PrivateKeyId": null, | ||
"P8PrivateKeyId_Comment": "10-digit p8 certificate id; often part of a downloadable certificate filename", | ||
"TeamId": null, | ||
"TeamId_Comment": "10-digit Apple team id shown on the Apple Developer Membership Page", | ||
"AppBundleIdentifier": null, | ||
"EnvironmentType": "Development", | ||
"EnvironmentType_Comment": "Apns Env one of Development or Production" | ||
"EnvironmentType": "Development" | ||
}, | ||
"AdsPushFirebase": { | ||
"AdsPushFirebase_Comment": "Filed names in service_account.json => project_id,private_key_id,private_key,client_email,client_id,client_x509_cert_url", | ||
"Type": "service_account", | ||
"AuthUri": "https://accounts.google.com/o/oauth2/auth", | ||
"TokenUri": "https://oauth2.googleapis.com/token", | ||
|
@@ -104,10 +92,12 @@ | |
//#endif | ||
"AllowedHosts": "*", | ||
"ForwardedHeaders": { | ||
"ForwardedHeaders_Comment": "These values apply only if your backend is hosted behind a CDN (such as Cloudflare).", | ||
"ForwardedHeaders": "All", | ||
"ForwardedHeaders_Comment": "These values apply only if your backend is hosted behind a CDN (such as `Cloudflare`).", | ||
"ForwardedHostHeaderName": "X-Forwarded-Host", | ||
"ForwardedHostHeaderName_Comment": "For Cloudflare, use X-Host instead of X-Forwarded-Host.", | ||
"ForwardedHeaders": "All" | ||
"AllowedHosts": [ "" ], | ||
"AllowedHosts_Comment": "If you're using a CDN like Cloudflare in front of your server, make sure to add your domain name to the `ForwardedHeaders:AllowedHosts` setting." | ||
}, | ||
"$schema": "https://json.schemastore.org/appsettings.json" | ||
} |
This file contains 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