From e8072597c87e3b05df05321b8814871df0344da2 Mon Sep 17 00:00:00 2001 From: Vit Listik Date: Sun, 30 Oct 2022 19:26:47 +0100 Subject: [PATCH] config support for sync connector --- cmd/config/main.go | 11 +---------- internal/cfg/cfg.go | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/cmd/config/main.go b/cmd/config/main.go index eaa68b8..a97536b 100644 --- a/cmd/config/main.go +++ b/cmd/config/main.go @@ -35,7 +35,7 @@ func main() { *configKey = strings.ToLower(*configKey) switch *configKey { case "bindcontrolr": - printBoolNormalized(config.BindControlR) + fmt.Println(config.BindControlR) case "port": fmt.Println(config.Port) case "sesswatchperiodseconds": @@ -47,12 +47,3 @@ func main() { os.Exit(1) } } - -// this might be unnecessary but I'm too lazy to look it up -func printBoolNormalized(x bool) { - if x { - fmt.Println("true") - } else { - fmt.Println("false") - } -} diff --git a/internal/cfg/cfg.go b/internal/cfg/cfg.go index 76bd73b..01ea46e 100644 --- a/internal/cfg/cfg.go +++ b/internal/cfg/cfg.go @@ -29,6 +29,8 @@ type configFile struct { // deprecated in v1 BindArrowKeysBash *bool BindArrowKeysZsh *bool + + SyncConnectorAddress *string } // Config returned by this package to be used in the rest of the project @@ -47,13 +49,22 @@ type Config struct { // SessionWatchPeriodSeconds is how often should daemon check if terminal // sessions are still alive // There is not much need to adjust the value both memory overhead of watched sessions - // and the CPU overhead of chacking them are relatively low + // and the CPU overhead of checking them are relatively low SessionWatchPeriodSeconds uint // ReshHistoryMinSize is how large resh history needs to be for // daemon to ignore standard shell history files - // Ignoring standard shell history gives us more consistent experience + // Ignoring standard shell history gives us more consistent experience, // but you can increase this to something large to see standard shell history in RESH search ReshHistoryMinSize int + + // SyncConnectorAddress used by the daemon to connect to the Sync Connector + // examples: + // - localhost:1234 + // - http://localhost:1234 + // - 192.168.1.1:1324 + // - https://domain.tld + // - https://domain.tld/resh + SyncConnectorAddress *string } // defaults for config @@ -166,6 +177,8 @@ func processAndFillDefaults(configF *configFile) (Config, error) { config.BindControlR = *configF.BindControlR } + config.SyncConnectorAddress = configF.SyncConnectorAddress + return config, err }