-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathClientConfigFile.cs
More file actions
26 lines (22 loc) · 917 Bytes
/
ClientConfigFile.cs
File metadata and controls
26 lines (22 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// -----------------------------------------------------------------------
// <copyright file="ClientConfigFile.cs" company="Petabridge, LLC">
// Copyright (C) 2026 - 2026 Petabridge, LLC <https://petabridge.com>
// </copyright>
// -----------------------------------------------------------------------
using System.Text.Json;
using Netclaw.Cli.Json;
using Netclaw.Configuration;
namespace Netclaw.Cli.Config;
internal sealed class ClientConfigFile
{
public string? Endpoint { get; init; }
public static void WriteEndpoint(NetclawPaths paths, string endpoint)
{
var dir = Path.GetDirectoryName(paths.ClientConfigPath);
if (dir is not null)
Directory.CreateDirectory(dir);
File.WriteAllText(
paths.ClientConfigPath,
JsonSerializer.Serialize(new ClientConfigFile { Endpoint = endpoint.TrimEnd('/') }, JsonDefaults.Indented));
}
}