Skip to content

Commit

Permalink
feat: support skipping node check on start
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Gianelloni <[email protected]>
  • Loading branch information
wolf31o2 committed Dec 10, 2024
1 parent 79724b8 commit d069454
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions cmd/cardano-node-api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down

0 comments on commit d069454

Please sign in to comment.