Skip to content

Commit

Permalink
Merge pull request #366 from bjorn-ali-goransson/prepend-sb-to-endpoi…
Browse files Browse the repository at this point in the history
…nt-if-not-present

Prepend sb:// to endpoint if not present
  • Loading branch information
ErikMogensen committed Jul 31, 2019
2 parents a630b40 + f1c994f commit ce77ecd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ServiceBusExplorer/Helpers/ServiceBusNamespace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public class ServiceBusNamespace
const string ServiceBusNamespaceIssuerNameIsNullOrEmpty = "The issuer name for the service bus namespace {0} is null or empty.";
const string ServiceBusNamespaceIssuerSecretIsNullOrEmpty = "The issuer secret for the service bus namespace {0} is null or empty.";
const string ServiceBusNamespaceEndpointIsNullOrEmpty = "The endpoint for the service bus namespace {0} is null or empty.";
const string ServiceBusNamespaceEndpointPrefixedWithSb = "The endpoint for the service bus namespace {0} is being automatically prefixed with \"sb://\".";
const string ServiceBusNamespaceStsEndpointIsNullOrEmpty = "The sts endpoint for the service bus namespace {0} is null or empty.";
const string ServiceBusNamespaceRuntimePortIsNullOrEmpty = "The runtime port for the service bus namespace {0} is null or empty.";
const string ServiceBusNamespaceManagementPortIsNullOrEmpty = "The management port for the service bus namespace {0} is null or empty.";
Expand Down Expand Up @@ -269,6 +270,12 @@ public static ServiceBusNamespace GetServiceBusNamespace(string key, string conn
return null;
}

if (!endpoint.Contains("://"))
{
staticWriteToLog(string.Format(CultureInfo.CurrentCulture, ServiceBusNamespaceEndpointPrefixedWithSb, endpoint));
endpoint = "sb://" + endpoint;
}

var stsEndpoint = parameters.ContainsKey(ConnectionStringStsEndpoint) ?
parameters[ConnectionStringStsEndpoint] :
null;
Expand Down

0 comments on commit ce77ecd

Please sign in to comment.