Skip to content

Commit

Permalink
Merge pull request #184 from blinklabs-io/feat/skipcheck
Browse files Browse the repository at this point in the history
feat: skipcheck
  • Loading branch information
wolf31o2 authored Feb 9, 2024
2 parents 22faf4e + e2c0099 commit 1413881
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,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
7 changes: 7 additions & 0 deletions config.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ node:
address:
port:

# Skip checking connection to cardano-node
#
# On startup, we connect to the configured cardano-node and exit on failure.
#
# Setting this to true will skip this check.
skipCheck:

# Timeout for connections to cardano-node
#
# This can also be set via the CARDANO_NODE_SOCKET_TIMEOUT environment
Expand Down
4 changes: 4 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type NodeConfig struct {
NetworkMagic uint32 `yaml:"networkMagic" envconfig:"CARDANO_NODE_NETWORK_MAGIC"`
Address string `yaml:"address" envconfig:"CARDANO_NODE_SOCKET_TCP_HOST"`
Port uint `yaml:"port" envconfig:"CARDANO_NODE_SOCKET_TCP_PORT"`
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 Expand Up @@ -132,6 +133,9 @@ func (c *Config) populateNetworkMagic() error {
}

func (c *Config) checkNode() error {
if c.Node.SkipCheck {
return nil
}
// Connect to cardano-node
oConn, err := ouroboros.NewConnection(
ouroboros.WithNetworkMagic(uint32(c.Node.NetworkMagic)),
Expand Down

0 comments on commit 1413881

Please sign in to comment.