Skip to content

Commit

Permalink
Adding new options for System Name Server (#597)
Browse files Browse the repository at this point in the history
  • Loading branch information
shibayan authored May 28, 2023
1 parent f885190 commit 897754d
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 9 deletions.
39 changes: 36 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore

# User-specific files
*.rsuser
Expand Down Expand Up @@ -90,6 +90,7 @@ StyleCopReport.xml
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
Expand Down Expand Up @@ -293,6 +294,17 @@ node_modules/
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp

# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp

# Visual Studio 6 technical files
*.ncb
*.aps

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
Expand Down Expand Up @@ -349,6 +361,9 @@ ASALocalRun/
# Local History for Visual Studio
.localhistory/

# Visual Studio History (VSHistory) files
.vshistory/

# BeatPulse healthcheck temp database
healthchecksdb

Expand All @@ -361,5 +376,23 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd

# Azure Resource Manager dependency files
ServiceDependencies/
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/

# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp

# JetBrains Rider
*.sln.iml
4 changes: 2 additions & 2 deletions KeyVault.Acmebot/KeyVault.Acmebot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AWSSDK.Route53" Version="3.7.104.68" />
<PackageReference Include="AWSSDK.Route53" Version="3.7.104.76" />
<PackageReference Include="Azure.Identity" Version="1.9.0" />
<PackageReference Include="Azure.ResourceManager.Dns" Version="1.0.1" />
<PackageReference Include="Azure.ResourceManager.PrivateDns" Version="1.0.1" />
Expand All @@ -14,7 +14,7 @@
<PackageReference Include="DurableTask.TypedProxy" Version="2.2.2" />
<PackageReference Include="Google.Apis.Dns.v1" Version="1.60.0.3018" />
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.9.4" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.9.5" />
<PackageReference Include="Microsoft.Extensions.Http" Version="[6.0.*,7.0.0)" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.2.0" />
<PackageReference Include="WebJobs.Extensions.HttpApi" Version="2.0.3" />
Expand Down
2 changes: 2 additions & 0 deletions KeyVault.Acmebot/Options/AcmebotOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public class AcmebotOptions
[Range(0, 365)]
public int RenewBeforeExpiry { get; set; } = 30;

public bool UseSystemNameServer { get; set; } = false;

public ExternalAccountBindingOptions ExternalAccountBinding { get; set; }

// Properties should be in alphabetical order
Expand Down
14 changes: 10 additions & 4 deletions KeyVault.Acmebot/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,17 @@ public override void Configure(IFunctionsHostBuilder builder)

builder.Services.AddSingleton<ITelemetryInitializer, ApplicationVersionInitializer<Startup>>();

builder.Services.AddSingleton(new LookupClient(new LookupClientOptions(NameServer.GooglePublicDns, NameServer.GooglePublicDns2)
builder.Services.AddSingleton(provider =>
{
UseCache = false,
UseRandomNameServer = true
}));
var options = provider.GetRequiredService<IOptions<AcmebotOptions>>();

var lookupClientOptions = options.Value.UseSystemNameServer ? new LookupClientOptions() : new LookupClientOptions(NameServer.GooglePublicDns, NameServer.GooglePublicDns2);

lookupClientOptions.UseCache = false;
lookupClientOptions.UseRandomNameServer = true;

return new LookupClient(lookupClientOptions);
});

builder.Services.AddSingleton(provider =>
{
Expand Down

0 comments on commit 897754d

Please sign in to comment.