From 7c34cd970f7efcff86f68308cfc66d452077ace6 Mon Sep 17 00:00:00 2001 From: mcamou Date: Thu, 28 Nov 2024 16:00:44 +0100 Subject: [PATCH] Add Viper default configs --- pkg/config/app.go | 6 ++++++ pkg/config/constants.go | 26 +++++++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/pkg/config/app.go b/pkg/config/app.go index b0c39186..e5bbbf9b 100644 --- a/pkg/config/app.go +++ b/pkg/config/app.go @@ -132,6 +132,12 @@ func (c *AppConfig) setDefaultConfig() { viper.SetDefault(PrivKeyFile, DefaultPrivKeyFile) viper.SetDefault(APIEnabled, false) + + viper.SetDefault(ProxyEnabled, true) + viper.SetDefault(ProxyListenAddr, "127.0.0.1") + viper.SetDefault(ProxyListenPort, "8888") + // TODO What is the default Cosmos port? + viper.SetDefault(ProxyTargetPort, "8080") } // setFileConfig loads configuration from a YAML file. diff --git a/pkg/config/constants.go b/pkg/config/constants.go index 7c1195c6..19a51cc3 100644 --- a/pkg/config/constants.go +++ b/pkg/config/constants.go @@ -30,16 +30,20 @@ const ( BlockTopic = "blockTopic" Rendezvous = "masa-mdns" PageSize = 25 + DefaultPrivKeyFile = "masa_oracle_key" - TwitterUsername = "TWITTER_USERNAME" - TwitterPassword = "TWITTER_PASSWORD" - Twitter2FaCode = "TWITTER_2FA_CODE" - DiscordBotToken = "DISCORD_BOT_TOKEN" - TwitterScraper = "TWITTER_SCRAPER" - DiscordScraper = "DISCORD_SCRAPER" - TelegramScraper = "TELEGRAM_SCRAPER" - WebScraper = "WEB_SCRAPER" - APIEnabled = "API_ENABLED" - ProxyEnabled = "PROXY_ENABLED" - DefaultPrivKeyFile = "masa_oracle_key" + TwitterUsername = "TWITTER_USERNAME" + TwitterPassword = "TWITTER_PASSWORD" + Twitter2FaCode = "TWITTER_2FA_CODE" + DiscordBotToken = "DISCORD_BOT_TOKEN" + TwitterScraper = "TWITTER_SCRAPER" + DiscordScraper = "DISCORD_SCRAPER" + TelegramScraper = "TELEGRAM_SCRAPER" + WebScraper = "WEB_SCRAPER" + APIEnabled = "API_ENABLED" + + ProxyEnabled = "PROXY_ENABLED" + ProxyListenAddr = "PROXY_LISTEN_ADDR" + ProxyListenPort = "PROXY_LISTEN_PORT" + ProxyTargetPort = "PROXY_TARGET_PORT" )