Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fly: add network env var #345

Merged
merged 2 commits into from
Aug 4, 2024
Merged
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
13 changes: 11 additions & 2 deletions fly/cmd/fly/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ var (
rpcUrl string
coreBridgeAddr string
credentialsFile string
network string
)

// Make a bigtable row key from a VAA
Expand Down Expand Up @@ -140,8 +141,6 @@ func verifyEnvVar(key string) string {

func main() {
loadEnvVars()
p2pNetworkID = p2p.MainnetNetworkId
p2pBootstrap = p2p.MainnetBootstrapPeers

lvl, err := ipfslog.LevelFromString(logLevel)
if err != nil {
Expand All @@ -151,6 +150,16 @@ func main() {

logger := ipfslog.Logger("wormhole-fly").Desugar()

env, err := common.ParseEnvironment(network)
if err != nil || (env != common.TestNet && env != common.MainNet) {
logger.Fatal("Invalid value for NETWORK, should be testnet or mainnet", zap.String("val", network))
}
p2pNetworkID = p2p.GetNetworkId(env)
p2pBootstrap, err = p2p.GetBootstrapPeers(env)
if err != nil {
logger.Fatal("failed to determine the bootstrap peers from the environment", zap.String("env", string(env)), zap.Error(err))
}

ipfslog.SetAllLoggers(lvl)

ctx := context.Background()
Expand Down
Loading