Skip to content

Commit

Permalink
added slot support.
Browse files Browse the repository at this point in the history
  • Loading branch information
ffMathy committed Jan 15, 2019
1 parent da00d51 commit fa38c09
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public async Task PersistAsync(PersistenceType persistenceType, byte[] bytes)
foreach (var app in apps)
{
logger.LogTrace("Checking hostnames of app {0} ({1}) against domains {2}.", app.Name, app.HostNames, domains);

if (!app.HostNames.Any(domains.Contains))
continue;

Expand Down Expand Up @@ -137,16 +137,33 @@ await client.WebApps.Manager

foreach (var domain in domainsToUpgrade)
{
await client.WebApps.Inner.CreateOrUpdateHostNameBindingWithHttpMessagesAsync(
azureOptions.ResourceGroupName,
app.Name,
domain,
new HostNameBindingInner(
azureResourceType: AzureResourceType.Website,
hostNameType: HostNameType.Verified,
customHostNameDnsRecordType: CustomHostNameDnsRecordType.CName,
sslState: SslState.SniEnabled,
thumbprint: azureCertificate.Thumbprint));
if (azureOptions.Slot != null)
{
await client.WebApps.Inner.CreateOrUpdateHostNameBindingSlotWithHttpMessagesAsync(
azureOptions.ResourceGroupName,
app.Name,
domain,
new HostNameBindingInner(
azureResourceType: AzureResourceType.Website,
hostNameType: HostNameType.Verified,
customHostNameDnsRecordType: CustomHostNameDnsRecordType.CName,
sslState: SslState.SniEnabled,
thumbprint: azureCertificate.Thumbprint),
azureOptions.Slot);
}
else
{
await client.WebApps.Inner.CreateOrUpdateHostNameBindingWithHttpMessagesAsync(
azureOptions.ResourceGroupName,
app.Name,
domain,
new HostNameBindingInner(
azureResourceType: AzureResourceType.Website,
hostNameType: HostNameType.Verified,
customHostNameDnsRecordType: CustomHostNameDnsRecordType.CName,
sslState: SslState.SniEnabled,
thumbprint: azureCertificate.Thumbprint));
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/FluffySpoon.AspNet.LetsEncrypt.Azure/AzureOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace FluffySpoon.LetsEncrypt.Azure
public class AzureOptions
{
public string ResourceGroupName { get; set; }
public string Slot { get;set; }

public AzureCredentials Credentials { get; set; }
}
Expand Down

0 comments on commit fa38c09

Please sign in to comment.