Skip to content

Commit

Permalink
create statiq azure web app for beckshome blog
Browse files Browse the repository at this point in the history
  • Loading branch information
thbst16 committed Aug 15, 2022
1 parent 0cf41e1 commit c9ccfab
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
28 changes: 28 additions & 0 deletions MyStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,36 @@ public MyStack()
Source = new FileAsset("./blobs/public/rosslyn-classes.txt"),
});

var staticWebsite = new StorageAccountStaticWebsite("staticBeckshomeBlog", new StorageAccountStaticWebsiteArgs
{
AccountName = storageAccount.Name,
ResourceGroupName = resourceGroup.Name,
IndexDocument = "index.html",
Error404Document = "404.html"
});

var indexHtmlBlob = new Blob("index.html", new BlobArgs
{
AccountName = storageAccount.Name,
ContainerName = staticWebsite.ContainerName,
ResourceGroupName = resourceGroup.Name,
Source = new FileAsset("./blobs/wwwroot/index.html"),
ContentType = "text/html"
});

var notFoundBlob = new Blob("404.html", new BlobArgs
{
AccountName = storageAccount.Name,
ContainerName = staticWebsite.ContainerName,
ResourceGroupName = resourceGroup.Name,
Source = new FileAsset("./blobs/wwwroot/404.html"),
ContentType = "text/html"
});

this.PrimaryStorageKey = GetStorageAccountPrimaryKey(resourceGroup.Name, storageAccount.Name);
this.PrimaryConnectionString = Output.Format($"DefaultEndpointsProtocol=https;AccountName={storageAccount.Name};AccountKey={this.PrimaryStorageKey};EndpointSuffix=core.windows.net");
this.RoslynClassUrl = Output.Format($"https://{storageAccount.Name}.blob.core.windows.net/public/rosslyn-classes.txt");
this.StaticEndpoint = storageAccount.PrimaryEndpoints.Apply(primaryEndpoints => primaryEndpoints.Web);

// Create Cognitive / Storage Service
var cogntiveAccount = new Pulumi.AzureNative.CognitiveServices.Account("beckshome-translation-2", new Pulumi.AzureNative.CognitiveServices.AccountArgs
Expand Down Expand Up @@ -358,6 +385,7 @@ public MyStack()
[Output] public Output<string> RosettaStoneEndpoint { get; set; }
[Output] public Output<string> RoslynApiEndpoint { get; set; }
[Output] public Output<string> RoslynClassUrl { get; set; }
[Output] public Output<string> StaticEndpoint {get; set;}
[Output] public Output<string> SheetsNotificationEndpoint { get; set; }
[Output] public Output<string> PrimaryStorageKey { get; set; }
[Output] public Output<string> PrimaryConnectionString {get; set;}
Expand Down
5 changes: 5 additions & 0 deletions blobs/wwwroot/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<html>
<body>
<h1>That's a 404! Still, from the Blob Storage.</h1>
</body>
</html>
5 changes: 5 additions & 0 deletions blobs/wwwroot/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<html>
<body>
<h1>This file is served from Blob Storage (courtesy of Pulumi!)</h1>
</body>
</html>

0 comments on commit c9ccfab

Please sign in to comment.