Skip to content

Commit

Permalink
Use CopySettingsForEmulator in PubSub clients
Browse files Browse the repository at this point in the history
  • Loading branch information
jskeet committed Apr 28, 2021
1 parent 6f8b4e0 commit 5022a1e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,21 @@ public new EmulatorDetection EmulatorDetection
private PublisherServiceApiClientBuilder MaybeCreateEmulatorClientBuilder()
{
var emulatorEnvironment = GetEmulatorEnvironment(s_emulatorEnvironmentVariables, s_emulatorEnvironmentVariables);
return emulatorEnvironment is null ? null :
// We don't set the EmulatorDetection property here to avoid recursively calling
// MaybeCreateEmulatorClientBuilder().
new PublisherServiceApiClientBuilder
{
Settings = Settings,
Endpoint = emulatorEnvironment[s_emulatorHostEnvironmentVariable],
ChannelCredentials = ChannelCredentials.Insecure,
ChannelOptions = ChannelOptions
};
if (emulatorEnvironment is null)
{
return null;
}
// We don't set the EmulatorDetection property here to avoid recursively calling
// MaybeCreateEmulatorClientBuilder().
var builder = new PublisherServiceApiClientBuilder
{
Settings = Settings,
Endpoint = emulatorEnvironment[s_emulatorHostEnvironmentVariable],
ChannelCredentials = ChannelCredentials.Insecure,
ChannelOptions = ChannelOptions
};
builder.CopySettingsForEmulator(this);
return builder;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,21 @@ public new EmulatorDetection EmulatorDetection
private SubscriberServiceApiClientBuilder MaybeCreateEmulatorClientBuilder()
{
var emulatorEnvironment = GetEmulatorEnvironment(s_emulatorEnvironmentVariables, s_emulatorEnvironmentVariables);
return emulatorEnvironment is null ? null :
// We don't set the EmulatorDetection property here to avoid recursively calling
// MaybeCreateEmulatorClientBuilder().
new SubscriberServiceApiClientBuilder
{
Settings = Settings,
Endpoint = emulatorEnvironment[s_emulatorHostEnvironmentVariable],
ChannelCredentials = ChannelCredentials.Insecure,
ChannelOptions = ChannelOptions
};
if (emulatorEnvironment is null)
{
return null;
}
// We don't set the EmulatorDetection property here to avoid recursively calling
// MaybeCreateEmulatorClientBuilder().
var builder = new SubscriberServiceApiClientBuilder
{
Settings = Settings,
Endpoint = emulatorEnvironment[s_emulatorHostEnvironmentVariable],
ChannelCredentials = ChannelCredentials.Insecure,
ChannelOptions = ChannelOptions
};
builder.CopySettingsForEmulator(this);
return builder;
}

/// <summary>
Expand Down

0 comments on commit 5022a1e

Please sign in to comment.