Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/SeqCli/Cli/Commands/ConfigCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static void Set(SeqCliConfig config, string key, string? value)
if (first == null)
throw new ArgumentException("The key could not be found; run the command without any arguments to view all keys.");

if (first.PropertyType == typeof(Dictionary<string, SeqCliConnectionConfig>))
if (first.PropertyType == typeof(Dictionary<string, ConnectionConfig>))
throw new NotSupportedException("Use `seqcli profile create` to configure connection profiles.");

var second = first.PropertyType.GetTypeInfo().DeclaredProperties
Expand Down
3 changes: 1 addition & 2 deletions src/SeqCli/Cli/Commands/Forward/RunCommand.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using SeqCli.Cli.Features;
using SeqCli.Config;
using SeqCli.Connection;
Expand All @@ -11,13 +12,11 @@ class RunCommand : Command
#pragma warning disable CS0414 // Field is assigned but its value is never used
bool _noLogo;
#pragma warning restore CS0414 // Field is assigned but its value is never used
readonly StoragePathFeature _storagePath;
readonly ListenUriFeature _listenUri;

public RunCommand(SeqConnectionFactory connectionFactory, SeqCliConfig config)
{
Options.Add("nologo", _ => _noLogo = true);
_storagePath = Enable<StoragePathFeature>();
_listenUri = Enable<ListenUriFeature>();
}
}
2 changes: 1 addition & 1 deletion src/SeqCli/Cli/Commands/Node/ListCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ListCommand : Command

string? _name, _id;

public ListCommand(SeqConnectionFactory connectionFactory, SeqCliOutputConfig outputConfig)
public ListCommand(SeqConnectionFactory connectionFactory, OutputConfig outputConfig)
{
_connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory));

Expand Down
2 changes: 1 addition & 1 deletion src/SeqCli/Cli/Commands/PrintCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class PrintCommand : Command
string? _filter, _template = OutputFormatFeature.DefaultOutputTemplate;
bool _noColor, _forceColor;

public PrintCommand(SeqCliOutputConfig outputConfig)
public PrintCommand(OutputConfig outputConfig)
{
if (outputConfig == null) throw new ArgumentNullException(nameof(outputConfig));
_noColor = outputConfig.DisableColor;
Expand Down
2 changes: 1 addition & 1 deletion src/SeqCli/Cli/Commands/Profile/CreateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ int RunSync()
try
{
var config = SeqCliConfig.Read();
config.Profiles[_name] = new SeqCliConnectionConfig { ServerUrl = _url, ApiKey = _apiKey };
config.Profiles[_name] = new ConnectionConfig { ServerUrl = _url, ApiKey = _apiKey };
SeqCliConfig.Write(config);
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/SeqCli/Cli/Features/OutputFormatFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class OutputFormatFeature : CommandFeature

bool _json, _noColor, _forceColor;

public OutputFormatFeature(SeqCliOutputConfig outputConfig)
public OutputFormatFeature(OutputConfig outputConfig)
{
_noColor = outputConfig.DisableColor;
_forceColor = outputConfig.ForceColor;
Expand Down
58 changes: 0 additions & 58 deletions src/SeqCli/Cli/Features/StoragePathFeature.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace SeqCli.Config;

class SeqCliConnectionConfig
class ConnectionConfig
{
const string ProtectedDataPrefix = "pd.";

Expand Down
6 changes: 6 additions & 0 deletions src/SeqCli/Config/Forwarder/ForwarderApiConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace SeqCli.Config;

class ForwarderApiConfig
{
public string ListenUri { get; set; } = "http://localhost:15341";
}
12 changes: 12 additions & 0 deletions src/SeqCli/Config/Forwarder/ForwarderConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace SeqCli.Config;

class ForwarderConfig
{
public uint? PooledConnectionLifetimeMilliseconds { get; set; } = null;
public ulong EventBodyLimitBytes { get; set; } = 256 * 1024;
public ulong PayloadLimitBytes { get; set; } = 10 * 1024 * 1024;

public ForwarderStorageConfig Storage { get; set; } = new();
public ForwarderDiagnosticConfig Diagnostics { get; set; } = new();
public ForwarderApiConfig Api { get; set; } = new();
}
29 changes: 29 additions & 0 deletions src/SeqCli/Config/Forwarder/ForwarderDiagnosticConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.IO;
using Serilog.Events;

namespace SeqCli.Config;

public class ForwarderDiagnosticConfig
{
public string InternalLogPath { get; set; } = GetDefaultInternalLogPath();
public LogEventLevel InternalLoggingLevel { get; set; } = LogEventLevel.Information;
public string? InternalLogServerUri { get; set; }
public string? InternalLogServerApiKey { get; set; }
public bool IngestionLogShowDetail { get; set; }

public static string GetDefaultInternalLogPath()
{
return Path.Combine(
#if WINDOWS
// Common, here, because the service may run as Local Service, which has no obvious home
// directory.
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
#else
// Specific to and writable by the current user.
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
#endif
"Seq",
"Logs");
}
}
6 changes: 6 additions & 0 deletions src/SeqCli/Config/Forwarder/ForwarderStorageConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace SeqCli.Config;

public class ForwarderStorageConfig
{
public int BufferSizeBytes { get; set; } = 67_108_864;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

namespace SeqCli.Config;

class SeqCliOutputConfig
public class OutputConfig
{
public bool DisableColor { get; set; }
public bool ForceColor { get; set; }
Expand Down
10 changes: 6 additions & 4 deletions src/SeqCli/Config/SeqCliConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ public static void Write(SeqCliConfig data)
File.WriteAllText(DefaultConfigFilename, content);
}

public SeqCliConnectionConfig Connection { get; set; } = new SeqCliConnectionConfig();
public SeqCliOutputConfig Output { get; set; } = new SeqCliOutputConfig();
public Dictionary<string, SeqCliConnectionConfig> Profiles { get; } =
new Dictionary<string, SeqCliConnectionConfig>(StringComparer.OrdinalIgnoreCase);
public ConnectionConfig Connection { get; set; } = new ConnectionConfig();
public OutputConfig Output { get; set; } = new();
public ForwarderConfig Forwarder { get; set; } = new();

public Dictionary<string, ConnectionConfig> Profiles { get; } =
new Dictionary<string, ConnectionConfig>(StringComparer.OrdinalIgnoreCase);
}