Skip to content

Commit 525b925

Browse files
committed
feat: read prefixes from sharpconfig
1 parent f09d5a0 commit 525b925

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/SharpWebserver/Program.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ it under the terms of the GNU General Public License as published by
88
*/
99

1010
using System.Net;
11-
using System.Net.Sockets;
1211
using CSScriptLib;
1312
using System;
1413
using System.IO;
@@ -93,7 +92,12 @@ static async Task Main(string[] args)
9392
HttpListener listener = new();
9493

9594
//Set valid prefixes
96-
listener.Prefixes.Add($"http://127.0.0.1:{GlobalConfig.PortNumber}/");
95+
foreach (var item in GlobalConfig.Prefixes)
96+
{
97+
//Prefixes should look like "http://127.0.0.1"
98+
//or "https://www.example.com"
99+
listener.Prefixes.Add($"{item}:{GlobalConfig.PortNumber}/");
100+
}
97101

98102
//Register the input handler
99103
var InputHandler = Task.Run(HandleInputAsync);

0 commit comments

Comments
 (0)