Add support for core PubSub config via json

This commit is contained in:
John Colvin committed 2024-06-06 09:15:16 -05:00
1 parent 6049826e90
commit c99d5fe24c
7 files changed
+177 -50

No files matched your search

@@ -1,5 +1,7 @@
namespace Bts.DataStreamPublisher;
using Bts.PubSub;
using CommandLine;
using System;
@@ -40,6 +42,9 @@ public class DataStreamPublisherConfig {
[Option("simple-echo-client", HelpText = "Run a simple echo client (won't publish tables or connect to sparkd)")]
public bool? SimpleEchoClient { get; set; }
[JsonPropertyName("pubsub")]
public PubSubConfig? PubSub { get; set; }
[Option(
"config",
MetaValue = "PATH",
@@ -47,11 +52,21 @@ public class DataStreamPublisherConfig {
[JsonIgnore]
public string? ConfigFile { get; set; }
public static DataStreamPublisherConfig Default() =>
new() {
User = "bts",
Sparkd = "http://localhost:8000/config",
SimpleEchoClient = false,
PubSub = PubSubConfig.Default(),
ConfigFile = null,
};
public void MergeWith(DataStreamPublisherConfig other) {
User ??= other.User;
Password ??= other.Password;
Sparkd ??= other.Sparkd;
Publishers ??= other.Publishers;
PubSub ??= other.PubSub;
SimpleEchoClient ??= other.SimpleEchoClient;
ConfigFile ??= other.ConfigFile;
}