diff --git a/README.md b/README.md index b08a472..d431279 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,8 @@ Cardano node configuration: - `CARDANO_NETWORK` - Use a named Cardano network (default: mainnet) - `CARDANO_NODE_NETWORK_MAGIC` - Cardano network magic (default: automatically determined from named network) +- `CARDANO_NODE_SKIP_CHECK` - Skip the connection test to Cardano Node on start + (default: false) - `CARDANO_NODE_SOCKET_PATH` - Socket path to Cardano node NtC via UNIX socket (default: /node-ipc/node.socket) - `CARDANO_NODE_SOCKET_TCP_HOST` - Address to Cardano node NtC via TCP diff --git a/cmd/cardano-node-api/main.go b/cmd/cardano-node-api/main.go index ca35380..3610488 100644 --- a/cmd/cardano-node-api/main.go +++ b/cmd/cardano-node-api/main.go @@ -64,10 +64,14 @@ func main() { }() // Test node connection - if oConn, err := node.GetConnection(nil); err != nil { - logger.Fatalf("failed to connect to node: %s", err) + if cfg.Node.SkipCheck { + logger.Debugf("skipping node check") } else { - oConn.Close() + if oConn, err := node.GetConnection(nil); err != nil { + logger.Fatalf("failed to connect to node: %s", err) + } else { + oConn.Close() + } } logger.Infof( diff --git a/internal/config/config.go b/internal/config/config.go index 03a214b..88cc33f 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -59,6 +59,7 @@ type NodeConfig struct { Address string `yaml:"address" envconfig:"CARDANO_NODE_SOCKET_TCP_HOST"` Port uint `yaml:"port" envconfig:"CARDANO_NODE_SOCKET_TCP_PORT"` QueryTimeout uint `yaml:"queryTimeout" envconfig:"CARDANO_NODE_SOCKET_QUERY_TIMEOUT"` + SkipCheck bool `yaml:"skipCheck" envconfig:"CARDANO_NODE_SKIP_CHECK"` SocketPath string `yaml:"socketPath" envconfig:"CARDANO_NODE_SOCKET_PATH"` Timeout uint `yaml:"timeout" envconfig:"CARDANO_NODE_SOCKET_TIMEOUT"` }