Skip to content

Commit

Permalink
Added Dns methods on FluentAPI as per Issue #122
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Toffia committed Nov 8, 2019
1 parent e377023 commit 249f6b9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
22 changes: 20 additions & 2 deletions Ductus.FluentDocker/Builders/ContainerBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
Expand Down Expand Up @@ -223,6 +223,24 @@ public ContainerBuilder HostIpMapping(string host, string ip)
return this;
}

public ContainerBuilder UseDns(params string []server)
{
_config.CreateParams.Dns = _config.CreateParams.Dns.ArrayAdd(server);
return this;
}

public ContainerBuilder UseDnsSearch(params string[] searchArg)
{
_config.CreateParams.DnsSearch = _config.CreateParams.DnsSearch.ArrayAdd(searchArg);
return this;
}

public ContainerBuilder UseDnsOption(params string[] option)
{
_config.CreateParams.DnsOpt = _config.CreateParams.DnsOpt.ArrayAdd(option);
return this;
}

public ContainerBuilder ExposePort(int hostPort, int containerPort)
{
_config.CreateParams.PortMappings = _config.CreateParams.PortMappings.ArrayAdd($"{hostPort}:{containerPort}");
Expand Down Expand Up @@ -719,4 +737,4 @@ private static bool IsNameMatch(string containerName, string test)
return Regex.IsMatch(containerName, $@"^\/?{test}$");
}
}
}
}
4 changes: 2 additions & 2 deletions Ductus.FluentDocker/Model/Builders/ContainerBuilderConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using Ductus.FluentDocker.Model.Common;
using Ductus.FluentDocker.Model.Compose;
Expand Down Expand Up @@ -41,4 +41,4 @@ public ContainerBuilderConfig()
public List<string> ExecuteOnRunningArguments { get; set; }
public List<string> ExecuteOnDisposingArguments { get; set; }
}
}
}

0 comments on commit 249f6b9

Please sign in to comment.