Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sjkp committed Apr 5, 2017
1 parent d3e0b51 commit fc559ec
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 11 deletions.
3 changes: 2 additions & 1 deletion LetsEncrypt-SiteExtension/Models/AuthenticationModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ public static explicit operator AuthenticationModel(AppSettingsAuthConfig config
AuthenticationEndpoint = config.AuthenticationEndpoint,
AzureWebSitesDefaultDomainName = config.AzureWebSitesDefaultDomainName,
ManagementEndpoint = config.ManagementEndpoint,
TokenAudience = config.TokenAudience
TokenAudience = config.TokenAudience,
SiteSlotName = config.SiteSlotName
};
}
}
Expand Down
1 change: 0 additions & 1 deletion LetsEncrypt.SiteExtension.Core/ArmHelper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using LetsEncrypt.SiteExtension.Models;
using Microsoft.Azure.Management.Resources;
using Microsoft.Azure.Management.WebSites;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.Rest;
Expand Down
2 changes: 1 addition & 1 deletion LetsEncrypt.SiteExtension.Core/KuduHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static KuduRestClient GetKuduClient(this WebSiteManagementClient client,
{
var user = client.WebApps.GetPublsihingCredentialSiteOrSlot(settings.ResourceGroupName, settings.WebAppName, settings.SiteSlotName);

return new KuduRestClient(settings, settings.WebAppName, user.PublishingUserName, user.PublishingPassword);
return new KuduRestClient(settings, user.PublishingUserName, user.PublishingPassword);
}
}
}
4 changes: 2 additions & 2 deletions LetsEncrypt.SiteExtension.Core/KuduRestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public class KuduRestClient
private string publishingUserName;
private string webAppName;

public KuduRestClient(IAzureEnvironment azureEnvironment, string webAppName, string publishingUserName, string publishingPassword)
public KuduRestClient(IAzureEnvironment azureEnvironment, string publishingUserName, string publishingPassword)
{
this.webAppName = webAppName;
this.webAppName = string.IsNullOrEmpty(azureEnvironment.SiteSlotName) ? azureEnvironment.WebAppName : azureEnvironment.WebAppName + "-" + azureEnvironment.SiteSlotName;
this.publishingUserName = publishingUserName;
this.publishingPassword = publishingPassword;
this.baseUri = $"https://{this.webAppName}.scm.{azureEnvironment.AzureWebSitesDefaultDomainName}";
Expand Down
8 changes: 5 additions & 3 deletions LetsEncrypt.SiteExtension.WebJob/Functions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ public class Functions
public static void AddCertificate([TimerTrigger(typeof(MonthlySchedule), RunOnStartup = true)] TimerInfo timerInfo, [Blob("letsencrypt/firstrun.job")] string input, [Blob("letsencrypt/firstrun.job")] out string output)
{
Console.WriteLine("Starting add certificate");
string websiteName = Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME");
var environment = new Models.AppSettingsAuthConfig();
string websiteName = environment.WebAppName + "-" + environment.SiteSlotName + "|";
if (string.IsNullOrEmpty(input) || !input.Contains(websiteName))
{
new CertificateManager(new Models.AppSettingsAuthConfig()).AddCertificate();
output = string.IsNullOrEmpty(input) ? websiteName : input + '|' + websiteName;
Console.WriteLine($"First run of add certificate for {websiteName}");
new CertificateManager(environment).AddCertificate();
output = string.IsNullOrEmpty(input) ? websiteName : input + websiteName;
}
else
{
Expand Down
3 changes: 2 additions & 1 deletion LetsEncrypt.SiteExtension.WebJob/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ static void Main()
config.UseTimers();
//A host ID must be between 1 and 32 characters, contain only lowercase letters, numbers, and
//dashes, not start or end with a dash, and not contain consecutive dashes.
var hostId = "letsencrypt-" + Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME");
var environment = new Models.AppSettingsAuthConfig();
var hostId = "le-" + environment.WebAppName + environment.SiteSlotName;
config.HostId = hostId.Substring(0,hostId.Length > 32 ? 32 : hostId.Length).TrimEnd(new[] { '-' }).ToLower();

var host = new JobHost(config);
Expand Down
2 changes: 1 addition & 1 deletion LetsEncrypt.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>letsencrypt</id>
<title>Azure Let's Encrypt (x86)</title>
<version>0.6.14</version>
<version>0.6.16</version>
<authors>SJKP</authors>
<licenseUrl>http://opensource.org/licenses/Apache-2.0</licenseUrl>
<projectUrl>https://github.com/sjkp/letsencrypt-siteextension</projectUrl>
Expand Down
2 changes: 1 addition & 1 deletion LetsEncrypt64.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>letsencrypt64</id>
<title>Azure Let's Encrypt (x64)</title>
<version>0.6.14</version>
<version>0.6.16</version>
<authors>SJKP</authors>
<licenseUrl>http://opensource.org/licenses/Apache-2.0</licenseUrl>
<projectUrl>https://github.com/sjkp/letsencrypt-siteextension</projectUrl>
Expand Down

0 comments on commit fc559ec

Please sign in to comment.