diff --git a/cmd/common.go b/cmd/common.go index e0308091..a3e9140b 100644 --- a/cmd/common.go +++ b/cmd/common.go @@ -57,6 +57,7 @@ func addNitroFlags(command *cobra.Command) { command.PersistentFlags().String("nitro-tls-key-filepath", "", "nitro tlsKeyFilepath") command.PersistentFlags().String("nitro-endpoint", "", "nitro endpoint") + command.PersistentFlags().Bool("nitro-is-secure", false, "nitro isSecure") // nitro flag bindings viper.BindPFlag("nitro.runNodeInProcess", command.PersistentFlags().Lookup("nitro-run-node-in-process")) @@ -78,4 +79,5 @@ func addNitroFlags(command *cobra.Command) { viper.BindPFlag("nitro.inProcesssNode.tlsKeyFilepath", command.PersistentFlags().Lookup("nitro-tls-key-filepath")) viper.BindPFlag("nitro.remoteNode.nitroEndpoint", command.PersistentFlags().Lookup("nitro-endpoint")) + viper.BindPFlag("nitro.remoteNode.isSecure", command.PersistentFlags().Lookup("nitro-is-secure")) } diff --git a/cmd/serve.go b/cmd/serve.go index cb43ca4c..a9f1d577 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -135,8 +135,7 @@ func serve() { } else { log.Info("Connecting to a remote Nitro node") - // TODO: Read from config file - isSecure := false + isSecure := nitroConfig.RemoteNode.IsSecure nitroRpcClient, err := nitroRpc.NewHttpRpcClient(nitroConfig.RemoteNode.NitroEndpoint, isSecure) if err != nil { logWithCommand.Fatal(err) diff --git a/environments/example.toml b/environments/example.toml index 07870405..2c7e4b39 100644 --- a/environments/example.toml +++ b/environments/example.toml @@ -54,3 +54,5 @@ [nitro.remoteNode] nitroEndpoint = "127.0.0.1:4005/api/v1" # NITRO_ENDPOINT + isSecure = false + diff --git a/pkg/serve/config.go b/pkg/serve/config.go index 0a9ec409..0405e9f9 100644 --- a/pkg/serve/config.go +++ b/pkg/serve/config.go @@ -91,6 +91,7 @@ const ( NITRO_USE_DURABLE_STORE = "NITRO_USE_DURABLE_STORE" NITRO_DURABLE_STORE_FOLDER = "NITRO_DURABLE_STORE_FOLDER" NITRO_ENDPOINT = "NITRO_ENDPOINT" + NITRO_IS_SECURE = "NITRO_IS_SECURE" NITRO_MSG_PORT = "NITRO_MSG_PORT" NITRO_WS_MSG_PORT = "NITRO_WS_MSG_PORT" NITRO_RPC_PORT = "NITRO_RPC_PORT" @@ -118,6 +119,7 @@ type InProcessNitroNodeConfig struct { type RemoteNitroNodeConfig struct { NitroEndpoint string + IsSecure bool } type NitroConfig struct { @@ -352,6 +354,7 @@ func (c *Config) loadNitroConfig() { viper.BindEnv("nitro.inProcesssNode.tlsKeyFilepath", NITRO_TLS_KEY_FILEPATH) viper.BindEnv("nitro.remoteNode.nitroEndpoint", NITRO_ENDPOINT) + viper.BindEnv("nitro.remoteNode.isSecure", NITRO_IS_SECURE) c.Nitro.RunNodeInProcess = viper.GetBool("nitro.runNodeInProcess") c.Nitro.RpcQueryRatesFile = viper.GetString("nitro.rpcQueryRatesFile") @@ -372,6 +375,7 @@ func (c *Config) loadNitroConfig() { c.Nitro.InProcessNode.TlsKeyFilepath = viper.GetString("nitro.inProcesssNode.tlsKeyFilepath") c.Nitro.RemoteNode.NitroEndpoint = viper.GetString("nitro.remoteNode.nitroEndpoint") + c.Nitro.RemoteNode.IsSecure = viper.GetBool("nitro.remoteNode.isSecure") } func (c *Config) loadGroupCacheConfig() {