Skip to content
This repository has been archived by the owner on Mar 5, 2020. It is now read-only.

Commit

Permalink
target-api and seednet-api are now provided inside the discovery_file
Browse files Browse the repository at this point in the history
Overridden by command line flags.
  • Loading branch information
abourget committed May 9, 2018
1 parent f998b38 commit 8e029a2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
20 changes: 18 additions & 2 deletions eos-bios/cmd/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,16 @@ func fetchNetwork(single bool) (*bios.Network, error) {

ipfs := bios.NewIPFS(viper.GetString("ipfs-gateway-address"))

seedNetHTTP := viper.GetString("seednet-api")
if seedNetHTTP == "" {
seedNetHTTP = discovery.SeedNetworkHTTPAddress
}
if seedNetHTTP == "" {
return nil, fmt.Errorf("missing `seed_network_http_address` and no `--seednet-api` override provided")
}

seedNetAPI := eos.New(
viper.GetString("seednet-api"),
seedNetHTTP,
discovery.SeedNetworkChainID,
)
// FIXME: when the blockchain uses the chain ID, we'll set it (!!)
Expand Down Expand Up @@ -66,8 +74,16 @@ func ipfsClient() (*shell.IdOutput, *shell.Shell) {
}

func setupBIOS(net *bios.Network) (b *bios.BIOS, err error) {
targetNetHTTP := viper.GetString("target-api")
if targetNetHTTP == "" {
targetNetHTTP = net.MyPeer.Discovery.TargetHTTPAddress
}
if targetNetHTTP == "" {
return nil, fmt.Errorf("missing `target_http_address` and no `--target-api` override provided")
}

targetNetAPI := eos.New(
viper.GetString("target-api"),
targetNetHTTP,
net.MyPeer.Discovery.TargetChainID,
)
// FIXME: this is until the blockchain (past dawn3) actually USES the chain ID
Expand Down
4 changes: 2 additions & 2 deletions eos-bios/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ func init() {

RootCmd.PersistentFlags().StringP("my-discovery", "", "my_discovery_file.yaml", "path to your local discovery file")
RootCmd.PersistentFlags().StringP("ipfs-gateway-address", "", "https://ipfs.io", "Address to reach an IPFS gateway. Used as a fallback if ipfs-local-gateway-address is unreachable.")
RootCmd.PersistentFlags().StringP("seednet-api", "", "http://stage0.example.com:8888", "API Address of a seed network nodeos instance")
RootCmd.PersistentFlags().StringP("seednet-api", "", "", "HTTP address of the seed network pointed to by your discovery file")
RootCmd.PersistentFlags().StringP("seednet-keys", "", "./privkeys.keys", "File containing private keys to your account on the seed network")
// RootCmd.PersistentFlags().StringVarP(&seedNetworkContract, "seednet-contract", "", "eosio.disco", "Contract account name on the seed network, where to find discovery files from all Block producer candidates.")
RootCmd.PersistentFlags().StringP("target-api", "", "http://127.0.0.1:8888", "API Address of the target network's nodeos instance that you control (for injection and verification)")
RootCmd.PersistentFlags().StringP("target-api", "", "", "HTTP address to reach the node you are starting (for injection and verification)")

RootCmd.PersistentFlags().StringP("cache-path", "", ".eos-bios-cache", "directory to store cached data from discovered network")

Expand Down

0 comments on commit 8e029a2

Please sign in to comment.