Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions input/chainsync/chainsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/SundaeSwap-finance/kugo"
"github.com/SundaeSwap-finance/ogmigo/v6/ouroboros/chainsync"
"github.com/blinklabs-io/adder/event"
"github.com/blinklabs-io/adder/internal/config"
"github.com/blinklabs-io/adder/internal/logging"
"github.com/blinklabs-io/adder/plugin"
ouroboros "github.com/blinklabs-io/gouroboros"
Expand Down Expand Up @@ -97,6 +98,8 @@ func New(options ...ChainSyncOptionFunc) *ChainSync {
intersectPoints: []ocommon.Point{},
status: &ChainSyncStatus{},
}
// Use Kupo URL from global config
c.kupoUrl = config.GetConfig().KupoUrl
for _, option := range options {
option(c)
}
Expand Down
7 changes: 0 additions & 7 deletions input/chainsync/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,6 @@ func WithBulkMode(bulkMode bool) ChainSyncOptionFunc {
return func(c *ChainSync) {}
}

// WithKupoUrl specifies the URL for a Kupo instance that will be queried for additional information
func WithKupoUrl(kupoUrl string) ChainSyncOptionFunc {
return func(c *ChainSync) {
c.kupoUrl = kupoUrl
}
}

// WithDelayConfirmationCount specifies the number of confirmations (subsequent blocks) are required before an event will be emitted
func WithDelayConfirmations(count uint) ChainSyncOptionFunc {
return func(c *ChainSync) {
Expand Down
9 changes: 0 additions & 9 deletions input/chainsync/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ var cmdlineOptions struct {
intersectPoint string
includeCbor bool
autoReconnect bool
kupoUrl string
delayConfirmations uint
}

Expand Down Expand Up @@ -112,13 +111,6 @@ func init() {
DefaultValue: true,
Dest: &(cmdlineOptions.autoReconnect),
},
{
Name: "kupo-url",
Type: plugin.PluginOptionTypeString,
Description: "kupo-url address",
DefaultValue: "",
Dest: &(cmdlineOptions.kupoUrl),
},
{
Name: "delay-confirmations",
Type: plugin.PluginOptionTypeUint,
Expand Down Expand Up @@ -149,7 +141,6 @@ func NewFromCmdlineOptions() plugin.Plugin {
WithNtcTcp(cmdlineOptions.ntcTcp),
WithIncludeCbor(cmdlineOptions.includeCbor),
WithAutoReconnect(cmdlineOptions.autoReconnect),
WithKupoUrl(cmdlineOptions.kupoUrl),
WithDelayConfirmations(cmdlineOptions.delayConfirmations),
}
if cmdlineOptions.intersectPoint != "" {
Expand Down
6 changes: 4 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type Config struct {
Input string `yaml:"input" envconfig:"INPUT"`
Output string `yaml:"output" envconfig:"OUTPUT"`
Plugin map[string]map[string]map[any]any `yaml:"plugins"`
KupoUrl string `yaml:"kupo_url" envconfig:"KUPO_URL"`
}

type ApiConfig struct {
Expand Down Expand Up @@ -67,8 +68,9 @@ var globalConfig = &Config{
ListenAddress: "localhost",
ListenPort: 0,
},
Input: DefaultInputPlugin,
Output: DefaultOutputPlugin,
Input: DefaultInputPlugin,
Output: DefaultOutputPlugin,
KupoUrl: "",
}

func (c *Config) Load(configFile string) error {
Expand Down