csharpdeeb25a2 | 1 | using CascadeIDE.Models; |
| 2 | |
| 3 | namespace CascadeIDE.Services; |
| 4 | |
| 5 | /// <summary>Agent API tokens для Intercom (не коммитить).</summary> |
| 6 | public static class IntercomAgentSecretsStorage |
| 7 | { |
| 8 | private static string GetPath() => |
| 9 | Path.Combine(SettingsService.GetSettingsDirectory(), "intercom-agent-secrets.toml"); |
| 10 | |
| 11 | public static IntercomAgentSecrets Load() |
| 12 | { |
| 13 | try |
| 14 | { |
| 15 | var path = GetPath(); |
| 16 | if (!File.Exists(path)) |
| 17 | return new IntercomAgentSecrets(); |
| 18 | var toml = File.ReadAllText(path); |
| 19 | return CascadeTomlSerializer.Deserialize<IntercomAgentSecrets>(toml) ?? new IntercomAgentSecrets(); |
| 20 | } |
| 21 | catch |
| 22 | { |
| 23 | return new IntercomAgentSecrets(); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | public static void Save(IntercomAgentSecrets secrets) |
| 28 | { |
| 29 | try |
| 30 | { |
| 31 | var toml = CascadeTomlSerializer.Serialize(secrets); |
| 32 | File.WriteAllText(GetPath(), toml); |
| 33 | } |
| 34 | catch |
| 35 | { |
| 36 | // best-effort |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | |
View only · write via MCP/CIDE