mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-09-08 10:10:49 +00:00
Port
This commit is contained in:
@@ -74,8 +74,37 @@ public static class ConfigurationResolver
|
||||
if (!Uri.TryCreate(endpoint, UriKind.Absolute, out var uri)
|
||||
|| !ValidSchemes.Contains(uri.Scheme, StringComparer.OrdinalIgnoreCase)
|
||||
|| string.IsNullOrWhiteSpace(uri.Host)
|
||||
|| !string.IsNullOrEmpty(uri.UserInfo))
|
||||
throw new CliException($"Endpoint \"{endpoint}\" is not a valid ep:// or ws:// endpoint.", ExitCodes.InvalidArguments);
|
||||
|| !string.IsNullOrEmpty(uri.UserInfo)
|
||||
|| !HasExplicitPort(endpoint))
|
||||
throw new CliException(
|
||||
$"Endpoint \"{endpoint}\" is not a valid ep:// or ws:// endpoint with an explicit port.",
|
||||
ExitCodes.InvalidArguments);
|
||||
}
|
||||
|
||||
static bool HasExplicitPort(string endpoint)
|
||||
{
|
||||
var schemeEnd = endpoint.IndexOf("://", StringComparison.Ordinal);
|
||||
if (schemeEnd < 0)
|
||||
return false;
|
||||
|
||||
var authorityStart = schemeEnd + 3;
|
||||
var authorityEnd = endpoint.IndexOfAny(['/', '?', '#'], authorityStart);
|
||||
if (authorityEnd < 0)
|
||||
authorityEnd = endpoint.Length;
|
||||
|
||||
var authority = endpoint[authorityStart..authorityEnd];
|
||||
var at = authority.LastIndexOf('@');
|
||||
if (at >= 0)
|
||||
authority = authority[(at + 1)..];
|
||||
|
||||
var colon = authority.StartsWith('[')
|
||||
? authority.IndexOf(']') + 1
|
||||
: authority.LastIndexOf(':');
|
||||
return colon > 0
|
||||
&& colon < authority.Length - 1
|
||||
&& authority[colon] == ':'
|
||||
&& ushort.TryParse(authority[(colon + 1)..], out var port)
|
||||
&& port > 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"profiles": {
|
||||
"Esiur.CLI": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "get-template ep://phase.delta.iq/sys/phase --dir c:\\temp\\an"
|
||||
"commandLineArgs": "get-template ep://phase.delta.iq:65535/sys/phase --dir c:\\temp\\an"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,13 +19,13 @@ Runtime-specific publishes are configured as self-contained, single-file, and no
|
||||
Create and verify a password-authenticated profile:
|
||||
|
||||
```console
|
||||
esiur login production ep://host --provider password --identity ahmed
|
||||
esiur login production "ep://host:${ESIUR_PORT}" --provider password --identity ahmed
|
||||
```
|
||||
|
||||
The password prompt does not echo input. For automation, supply it on standard input:
|
||||
|
||||
```console
|
||||
printf '%s' "$ESIUR_PASSWORD" | esiur login production ep://host \
|
||||
printf '%s' "$ESIUR_PASSWORD" | esiur login production "ep://host:${ESIUR_PORT}" \
|
||||
--provider password --identity ahmed --password-stdin
|
||||
```
|
||||
|
||||
@@ -86,7 +86,7 @@ Every operational command accepts a saved profile or a temporary endpoint:
|
||||
|
||||
```console
|
||||
esiur --profile production describe sys/service
|
||||
esiur --endpoint ep://host query sys --output json
|
||||
esiur --endpoint "ep://host:${ESIUR_PORT}" query sys --output json
|
||||
esiur get sys/service Name --timeout 30s
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user