Skip to content

Commit

Permalink
Remove remote-node-url since connector info provided by tezosconnect.yml
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Semenyuk <[email protected]>
  • Loading branch information
alex-semenyuk committed Dec 21, 2023
1 parent de9ad2f commit 8004631
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 19 deletions.
5 changes: 2 additions & 3 deletions cmd/init_tezos.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,15 @@ var initTezosCmd = &cobra.Command{
}

func validateTezosFlags() error {
if initOptions.RemoteNodeURL == "" {
return fmt.Errorf("you must provide 'remote-node-url' flag as local node mode is not supported")
if initOptions.ExtraConnectorConfigPath == "" {
return fmt.Errorf("you must provide 'connector-config' flag with path to 'tezosconnect.yml' config file")
}
return nil
}

func init() {
initTezosCmd.Flags().IntVar(&initOptions.BlockPeriod, "block-period", -1, "Block period in seconds. Default is variable based on selected blockchain provider.")
initTezosCmd.Flags().StringVar(&initOptions.ContractAddress, "contract-address", "", "Do not automatically deploy a contract, instead use a pre-configured address")
initTezosCmd.Flags().StringVar(&initOptions.RemoteNodeURL, "remote-node-url", "", "For cases where the node is pre-existing and running remotely")

initCmd.AddCommand(initTezosCmd)
}
2 changes: 1 addition & 1 deletion internal/blockchain/tezos/connector/connector_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

type Connector interface {
GetServiceDefinitions(s *types.Stack, dependentServices map[string]string) []*docker.ServiceDefinition
GenerateConfig(stack *types.Stack, member *types.Organization, signerHostname, rpcURL string) Config
GenerateConfig(stack *types.Stack, member *types.Organization, signerHostname string) Config
Name() string
Port() int
}
Expand Down
15 changes: 1 addition & 14 deletions internal/blockchain/tezos/connector/tezosconnect/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package tezosconnect
import (
"fmt"
"os"
"strings"

"github.com/hyperledger/firefly-cli/internal/blockchain/tezos/connector"
"github.com/hyperledger/firefly-cli/pkg/types"
Expand Down Expand Up @@ -91,7 +90,7 @@ func (c *Config) WriteConfig(filename string, extraTezosconnectConfigPath string
return nil
}

func (t *Tezosconnect) GenerateConfig(stack *types.Stack, org *types.Organization, signerHostname, rpcURL string) connector.Config {
func (t *Tezosconnect) GenerateConfig(stack *types.Stack, org *types.Organization, signerHostname string) connector.Config {
confirmations := new(int)
*confirmations = 0
var metrics *types.MetricsServerConfig
Expand All @@ -110,11 +109,6 @@ func (t *Tezosconnect) GenerateConfig(stack *types.Stack, org *types.Organizatio
metrics = nil
}

network := "mainnet"
if strings.Contains(rpcURL, "ghost") {
network = "ghostnet"
}

return &Config{
Log: &types.LogConfig{
Level: "debug",
Expand All @@ -124,13 +118,6 @@ func (t *Tezosconnect) GenerateConfig(stack *types.Stack, org *types.Organizatio
Address: "0.0.0.0",
PublicURL: fmt.Sprintf("http://127.0.0.1:%v", org.ExposedConnectorPort),
},
Connector: &ConnectorConfig{
Blockchain: &BlockchainConfig{
Network: network,
RPC: rpcURL,
Signatory: fmt.Sprintf("http://%s:6732", signerHostname),
},
},
Persistence: &PersistenceConfig{
LevelDB: &LevelDBConfig{
Path: "/tezosconnect/leveldb",
Expand Down
2 changes: 1 addition & 1 deletion internal/blockchain/tezos/remoterpc/remoterpc_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (p *RemoteRPCProvider) WriteConfig(options *types.InitOptions) error {
for i, member := range p.stack.Members {
// Generate the connector config for each member
connectorConfigPath := filepath.Join(initDir, "config", fmt.Sprintf("%s_%v.yaml", p.connector.Name(), i))
if err := p.connector.GenerateConfig(p.stack, member, "tezossigner", options.RemoteNodeURL).WriteConfig(connectorConfigPath, options.ExtraConnectorConfigPath); err != nil {
if err := p.connector.GenerateConfig(p.stack, member, "tezossigner").WriteConfig(connectorConfigPath, options.ExtraConnectorConfigPath); err != nil {
return err
}
}
Expand Down

0 comments on commit 8004631

Please sign in to comment.