Skip to content

Commit

Permalink
Moved required variables to appsettings files instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
jezzsantos committed Jan 3, 2025
1 parent d41f3c9 commit 3f47aef
Show file tree
Hide file tree
Showing 18 changed files with 176 additions and 162 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ permissions:
env:
IS_CI_BUILD: 'true'
SOLUTION_PATH: 'src/SaaStack.sln'
TESTINGONLY_BUILD_CONFIGURATION: 'Release'
DEPLOY_BUILD_CONFIGURATION: 'ReleaseForDeploy'
DOTNET_VERSION: 8.0.302

Expand Down Expand Up @@ -45,7 +44,7 @@ jobs:
- name: AppSettings Variable Substitution
uses: ./src/Tools.GitHubActions/VariableSubstitution
with:
files: '**/appsettings.json,**/appsettings.Azure.json,**/appsettings.AWS.json,**/appsettings.Deploy.json'
files: '**/appsettings.json,**/appsettings.Azure.json,**/appsettings.AWS.json'
variables: ${{ toJSON(vars)}}
secrets: ${{ toJSON(secrets)}}
- name: Deploy to Azure
Expand Down
1 change: 0 additions & 1 deletion src/AWSLambdas.Api.WorkerHost/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public void ConfigureServices(IServiceCollection services)
{
var configurationBuilder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", false, false)
.AddJsonFile("appsettings.Deploy.json", true, false)
.AddJsonFile("appsettings.local.json", true, false)
.AddEnvironmentVariables();
var configuration = configurationBuilder.Build();
Expand Down
17 changes: 0 additions & 17 deletions src/AWSLambdas.Api.WorkerHost/appsettings.Deploy.json

This file was deleted.

16 changes: 16 additions & 0 deletions src/AWSLambdas.Api.WorkerHost/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,21 @@
"WebsiteHost": {
"BaseUrl": "https://localhost:5101"
}
},
"Deploy": {
"Notes": "Lists the required configuration keys that must be overwritten (by GitHub action) when we deploy this host",
"Instructions": "Whenever you add new settings to the top part of this file, consider adding them to the list below if you need them overwritten for deployment",
"Required": [
{
"Description": "AWS specific settings from appsettings.json",
"Keys": [
"Hosts:ApiHost1:BaseUrl",
"Hosts:ApiHost1:HMACAuthNSecret",
"Hosts:AncillaryApi:BaseUrl",
"Hosts:AncillaryApi:HMACAuthNSecret",
"Hosts:WebsiteHost:BaseUrl"
]
}
]
}
}
15 changes: 15 additions & 0 deletions src/ApiHost1/appsettings.AWS.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,20 @@
"BucketNamespace": ""
}
}
},
"Deploy": {
"Notes": "Lists the required configuration keys that must be overwritten (by the GitHub configuration action) when we deploy this host",
"Instructions": "Whenever you add new settings to the top part of this file, consider adding them to the list below if you need them overwritten for deployment",
"Required": [
{
"Disabled": true,
"Keys": [
"ApplicationServices:Persistence:AWS:AccessKey",
"ApplicationServices:Persistence:AWS:SecretKey",
"ApplicationServices:Persistence:AWS:Region",
"ApplicationServices:Persistence:AWS:BucketNamespace"
]
}
]
}
}
28 changes: 28 additions & 0 deletions src/ApiHost1/appsettings.Azure.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,33 @@
"ClientSecret": "",
"RedirectUri": "https://localhost:5001/sso/microsoft"
}
},
"Deploy": {
"Notes": "Lists the required configuration keys that must be overwritten (by the GitHub configuration action) when we deploy this host",
"Instructions": "Whenever you add new settings to the top part of this file, consider adding them to the list below if you need them overwritten for deployment",
"Required": [
{
"Keys": [
"ApplicationInsights:ConnectionString",
"ApplicationServices:Persistence:AzureStorageAccount:AccountName",
"ApplicationServices:Persistence:AzureStorageAccount:AccountKey",
"ApplicationServices:Persistence:AzureServiceBus:ConnectionString",
"ApplicationServices:Persistence:SqlServer:DbServerName",
"ApplicationServices:Persistence:SqlServer:DbCredentials",
"ApplicationServices:Persistence:SqlServer:DbName"
]
},
{
"Description": "Settings for specific optional technology adapters",
"Instructions": "If you configure any of these technology adapters to be the default at runtime, via dependency injection, then move those Keys to the previous section",
"Disabled": true,
"Keys": [
"ApplicationServices:MicrosoftIdentity:BaseUrl",
"ApplicationServices:MicrosoftIdentity:ClientId",
"ApplicationServices:MicrosoftIdentity:ClientSecret",
"ApplicationServices:MicrosoftIdentity:RedirectUri"
]
}
]
}
}
83 changes: 0 additions & 83 deletions src/ApiHost1/appsettings.Deploy.json

This file was deleted.

51 changes: 51 additions & 0 deletions src/ApiHost1/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,56 @@
"WebsiteHost": {
"BaseUrl": "https://localhost:5101"
}
},
"Deploy": {
"Notes": "Lists the required configuration keys that must be overwritten (by the GitHub configuration action) when we deploy this host",
"Instructions": "Whenever you add new settings to the top part of this file, consider adding them to the list below if you need them overwritten for deployment",
"Required": [
{
"Description": "General settings from this appsettings.json",
"Keys": [
"ApplicationServices:SSOProvidersService:SSOUserTokens:AesSecret",
"ApplicationServices:Gravatar:BaseUrl",
"Hosts:AncillaryApi:BaseUrl",
"Hosts:AncillaryApi:HMACAuthNSecret",
"Hosts:IdentityApi:BaseUrl",
"Hosts:IdentityApi:JWT:SigningSecret",
"Hosts:ImagesApi:BaseUrl",
"Hosts:EndUsersApi:Authorization:OperatorWhitelist",
"Hosts:WebsiteHost:BaseUrl"
]
},
{
"Description": "Settings for specific optional technology adapters",
"Instructions": "If you configure any of these technology adapters to be the default at runtime, via dependency injection, then move those Keys to the previous section",
"Disabled": true,
"Keys": [
"ApplicationServices:Persistence:Kurrent:ConnectionString",
"ApplicationServices:Chargebee:BaseUrl",
"ApplicationServices:Chargebee:ApiKey",
"ApplicationServices:Chargebee:SiteName",
"ApplicationServices:Chargebee:ProductFamilyId",
"ApplicationServices:Chargebee:Plans:StartingPlanId",
"ApplicationServices:Chargebee:Plans:Tier1PlanIds",
"ApplicationServices:Chargebee:Plans:Tier2PlanIds",
"ApplicationServices:Chargebee:Plans:Tier3PlanIds",
"ApplicationServices:Chargebee:Webhook:Username",
"ApplicationServices:Chargebee:Webhook:Password",
"ApplicationServices:Flagsmith:BaseUrl",
"ApplicationServices:Flagsmith:EnvironmentKey",
"ApplicationServices:Mailgun:BaseUrl",
"ApplicationServices:Mailgun:DomainName",
"ApplicationServices:Mailgun:ApiKey",
"ApplicationServices:Mailgun:WebhookSigningKey",
"ApplicationServices:Twilio:BaseUrl",
"ApplicationServices:Twilio:AccountSid",
"ApplicationServices:Twilio:AuthToken",
"ApplicationServices:Twilio:SenderPhoneNumber",
"ApplicationServices:Twilio:WebhookCallbackUrl",
"ApplicationServices:UserPilot:BaseUrl",
"ApplicationServices:UserPilot:ApiKey"
]
}
]
}
}
1 change: 0 additions & 1 deletion src/AzureFunctions.Api.WorkerHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
{
builder
.AddJsonFile("appsettings.json", false, false)
.AddJsonFile("appsettings.Deploy.json", true, false)
.AddJsonFile("appsettings.local.json", true, false)
.AddEnvironmentVariables();
})
Expand Down
17 changes: 0 additions & 17 deletions src/AzureFunctions.Api.WorkerHost/appsettings.Deploy.json

This file was deleted.

16 changes: 16 additions & 0 deletions src/AzureFunctions.Api.WorkerHost/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,21 @@
"WebsiteHost": {
"BaseUrl": "https://localhost:5101"
}
},
"Deploy": {
"Notes": "Lists the required configuration keys that must be overwritten (by GitHub action) when we deploy this host",
"Instructions": "Whenever you add new settings to the top part of this file, consider adding them to the list below if you need them overwritten for deployment",
"Required": [
{
"Description": "Azure specific settings from appsettings.json",
"Keys": [
"Hosts:ApiHost1:BaseUrl",
"Hosts:ApiHost1:HMACAuthNSecret",
"Hosts:AncillaryApi:BaseUrl",
"Hosts:AncillaryApi:HMACAuthNSecret",
"Hosts:WebsiteHost:BaseUrl"
]
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ void RegisterConfiguration(bool isMultiTenanted)
#elif HOSTEDONAWS
appBuilder.Configuration.AddJsonFile("appsettings.AWS.json", true);
#endif
appBuilder.Configuration.AddJsonFile("appsettings.Deploy.json", true);
appBuilder.Configuration.AddJsonFile("appsettings.local.json", true);

if (isMultiTenanted)
Expand Down
2 changes: 1 addition & 1 deletion src/Tools.GitHubActions/VariableSubstitution/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ For example,
"Notes": "Lists the required configuration keys that must be overwritten (by the GitHub configuration action) when we deploy this host",
"Required": [
{
"Description": "General settings from appsettings.json",
"Description": "General settings from this appsettings.json",
"Keys": [
"ApplicationServices:Persistence:Kurrent:ConnectionString",
"Hosts:WebsiteHost:BaseUrl"
Expand Down
4 changes: 2 additions & 2 deletions src/Tools.GitHubActions/VariableSubstitution/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ inputs:
required: true
default: '**/appsettings.json'
secrets:
description: 'The secrets of the GitHub repository. Must be the value: `${{ toJSON(secrets)}}`'
description: 'The secrets of the GitHub repository. Must be the value: \$\{\{ toJSON(secrets)\}\}'
required: true
variables:
description: 'The variables of the GitHub repository (and environment). Must be the value: `${{ toJSON(vars)}}`'
description: 'The variables of the GitHub repository (and environment). Must be the value: \$\{\{ toJSON(vars)\}\}'
required: true
runs:
using: 'node20'
Expand Down
15 changes: 15 additions & 0 deletions src/WebsiteHost/appsettings.AWS.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,20 @@
"BucketNamespace": ""
}
}
},
"Deploy": {
"Notes": "Lists the required configuration keys that must be overwritten (by the GitHub configuration action) when we deploy this host",
"Instructions": "Whenever you add new settings to the top part of this file, consider adding them to the list below if you need them overwritten for deployment",
"Required": [
{
"Disabled": true,
"Keys": [
"ApplicationServices:Persistence:AWS:AccessKey",
"ApplicationServices:Persistence:AWS:SecretKey",
"ApplicationServices:Persistence:AWS:Region",
"ApplicationServices:Persistence:AWS:BucketNamespace"
]
}
]
}
}
13 changes: 13 additions & 0 deletions src/WebsiteHost/appsettings.Azure.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,18 @@
"AccountKey": ""
}
}
},
"Deploy": {
"Notes": "Lists the required configuration keys that must be overwritten (by the GitHub configuration action) when we deploy this host",
"Instructions": "Whenever you add new settings to the top part of this file, consider adding them to the list below if you need them overwritten for deployment",
"Required": [
{
"Keys": [
"ApplicationInsights:ConnectionString",
"ApplicationServices:Persistence:AzureStorageAccount:AccountName",
"ApplicationServices:Persistence:AzureStorageAccount:AccountKey"
]
}
]
}
}
Loading

0 comments on commit 3f47aef

Please sign in to comment.