fix(service): escape bind value and parse port as int in seeded config
This commit is contained in:
@@ -60,14 +60,15 @@ public static class ServiceCommands
|
||||
|
||||
if (!File.Exists(configPath))
|
||||
{
|
||||
var port = ClientCommands.GetOption(args, "--port") ?? "47822";
|
||||
var portStr = ClientCommands.GetOption(args, "--port");
|
||||
var port = int.TryParse(portStr, out var p) ? p : 47822;
|
||||
var bind = ClientCommands.GetOption(args, "--bind") ?? "127.0.0.1";
|
||||
var dbPath = ClientCommands.GetOption(args, "--db-path") ?? defaultDbPath;
|
||||
|
||||
var json = $$"""
|
||||
{
|
||||
"port": {{port}},
|
||||
"bind": "{{bind}}",
|
||||
"bind": {{System.Text.Json.JsonSerializer.Serialize(bind)}},
|
||||
"dbPath": {{System.Text.Json.JsonSerializer.Serialize(dbPath)}}
|
||||
}
|
||||
""";
|
||||
|
||||
Reference in New Issue
Block a user