Skip to content

Commit

Permalink
HostBuilder::UseHost -> WithService issue #185
Browse files Browse the repository at this point in the history
  • Loading branch information
mariotoffia committed Apr 5, 2021
1 parent 2d60e39 commit 3267291
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions Ductus.FluentDocker/Builders/HostBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ internal HostBuilder(IBuilder builder) : base(builder)
public override IHostService Build()
{

if (this.customHostService != null) {
if (this.customHostService != null)
{
return this.customHostService;
}

Expand All @@ -36,12 +37,18 @@ public HostBuilder UseNative()
return this;
}

public HostBuilder UseHost(IHostService customHostService) {
/// <summary>
/// This function will use a custom host service already instantiated.
/// </summary>
/// <param name="customHostService">The instantiated IHostService</param>
/// <returns>Itself for fluent access.</returns>
public HostBuilder WithService(IHostService customHostService)
{
this.customHostService = customHostService;
return this;
}

/// <summary>
/// <summary>
/// Creates a `IHostService` based on a _URI_.
/// </summary>
/// <param name="uri">The _URI_ to the docker daemon.</param>
Expand All @@ -54,15 +61,15 @@ public HostBuilder UseHost(IHostService customHostService) {
/// it will try to get it from the environment _DOCKER_CERT_PATH_.
/// </param>
/// <returns>Itself for fluent access.</returns>
public HostBuilder FromUri(
DockerUri uri,
string name = null,
bool isNative = true,
bool stopWhenDisposed = false,
bool isWindowsHost = false,
string certificatePath = null)
public HostBuilder FromUri(
DockerUri uri,
string name = null,
bool isNative = true,
bool stopWhenDisposed = false,
bool isWindowsHost = false,
string certificatePath = null)
{
this.customHostService = new Hosts().FromUri(uri,name,isNative,stopWhenDisposed,isWindowsHost,certificatePath);
this.customHostService = new Hosts().FromUri(uri, name, isNative, stopWhenDisposed, isWindowsHost, certificatePath);
return this;
}

Expand Down

0 comments on commit 3267291

Please sign in to comment.