Skip to content

Commit bdd4ca5

Browse files
committed
feat: configure custom domains and certificates for Azure Container App
1 parent 898642c commit bdd4ca5

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

AppHost/AppHost.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55

66
var builder = DistributedApplication.CreateBuilder(args);
77

8+
var apexDomain = builder.AddParameter("domainApex");
9+
var wwwDomain = builder.AddParameter("domainWww");
10+
var certName = builder.AddParameter("certificateName");
11+
var wwwCertName = builder.AddParameter("wwwCertificateName");
12+
813
// NOTE: The type returned by AddAzureStorage is IResourceBuilder<AzureStorageResource>,
914
// but if storage is being cast or wrapped, ensure it is of the correct type for extension methods.
1015
var storage = builder.AddAzureStorage("azure-storage")
@@ -22,6 +27,13 @@
2227
var web = builder.AddProject<Web>("web")
2328
.WithReference(tables)
2429
.WaitFor(tables)
25-
.WithExternalHttpEndpoints();
30+
.WithExternalHttpEndpoints()
31+
.PublishAsAzureContainerApp((mod,app) =>
32+
{
33+
#pragma warning disable ASPIREACADOMAINS001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
34+
app.ConfigureCustomDomain(apexDomain, certName);
35+
app.ConfigureCustomDomain(wwwDomain, wwwCertName);
36+
#pragma warning restore ASPIREACADOMAINS001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
37+
});
2638

2739
builder.Build().Run();

AppHost/appsettings.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"Parameters": {
3-
"customDomain": "copilotthatjawn.com",
4-
"certificateName": ""
3+
"apexDomain": "copilotthatjawn.com",
4+
"wwwDomain": "www.copilotthatjawn.com",
5+
"certificateName": "copilotthatjawn.com-cae-uanp-250608192822",
6+
"wwwCertificateName": "www.copilotthatjawn.com-cae-uanp-250608193349"
57
},
68
"Logging": {
79
"LogLevel": {

0 commit comments

Comments
 (0)