Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit 5dd68a4

Browse files
allow setting port from cli
1 parent 77e2e0e commit 5dd68a4

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/SqlStreamStore.HAL.DevServer/Program.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
internal static class Program
2727
{
2828
private static readonly Random s_random = new Random();
29+
private const int DefaultPort = 8001;
2930

3031
public static async Task<int> Main(string[] args)
3132
{
@@ -34,10 +35,18 @@ public static async Task<int> Main(string[] args)
3435
AddServerHeader = false
3536
};
3637

38+
if(!int.TryParse(args.FirstOrDefault(), out var port))
39+
{
40+
port = DefaultPort;
41+
};
42+
3743
using(var server = new KestrelOwinServer(options))
3844
using(var streamStore = new InMemoryStreamStore())
3945
{
40-
await server.Start("http://localhost:8001", Configure(streamStore), CancellationToken.None);
46+
await server.Start(new UriBuilder
47+
{
48+
Port = port
49+
}.Uri.ToString(), Configure(streamStore), CancellationToken.None);
4150

4251
DisplayMenu(streamStore);
4352
}

0 commit comments

Comments
 (0)