|
|
|
@ -1,19 +1,29 @@
|
|
|
|
|
using Connected.Services;
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
|
|
|
|
|
namespace Connected.ServiceModel.Client.Net;
|
|
|
|
|
|
|
|
|
|
internal sealed class SelectUrl : ServiceFunction<ConnectedServerUrlArgs, string>
|
|
|
|
|
{
|
|
|
|
|
private const string Root = "https://localhost:61599";//"https://connected.tompit.com";
|
|
|
|
|
protected override async Task<string?> OnInvoke()
|
|
|
|
|
private const string Root = "https://connected.tompit.com";
|
|
|
|
|
private readonly string? _rootOverride = null;
|
|
|
|
|
|
|
|
|
|
public SelectUrl(IConfiguration configuration)
|
|
|
|
|
{
|
|
|
|
|
_rootOverride = configuration?.GetValue<string?>("connectedServicesRootUrl", null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string RootUrl => string.IsNullOrWhiteSpace(_rootOverride) ? Root : _rootOverride;
|
|
|
|
|
|
|
|
|
|
protected override async Task<string> OnInvoke()
|
|
|
|
|
{
|
|
|
|
|
await Task.CompletedTask;
|
|
|
|
|
|
|
|
|
|
return Arguments.Kind switch
|
|
|
|
|
{
|
|
|
|
|
ConnectedUrlKind.Root => Root,
|
|
|
|
|
ConnectedUrlKind.FileSystem => $"{Root}/services/fileSystem",
|
|
|
|
|
ConnectedUrlKind.TableStorage => $"{Root}/services/tables",
|
|
|
|
|
ConnectedUrlKind.Root => RootUrl,
|
|
|
|
|
ConnectedUrlKind.FileSystem => $"{RootUrl}/services/fileSystem",
|
|
|
|
|
ConnectedUrlKind.TableStorage => $"{RootUrl}/services/tables",
|
|
|
|
|
_ => throw new NotImplementedException(),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|