Skip to content

Commit c10aeb2

Browse files
panoelevan-gray
authored andcommitted
fly: add network env var
1 parent 58d376f commit c10aeb2

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

fly/cmd/fly/main.go

+12-2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ var (
4949
rpcUrl string
5050
coreBridgeAddr string
5151
credentialsFile string
52+
network string
5253
)
5354

5455
// Make a bigtable row key from a VAA
@@ -128,6 +129,7 @@ func loadEnvVars() {
128129
rpcUrl = verifyEnvVar("RPC_URL")
129130
coreBridgeAddr = verifyEnvVar("CORE_BRIDGE_ADDR")
130131
credentialsFile = verifyEnvVar("CREDENTIALS_FILE")
132+
network = verifyEnvVar("NETWORK")
131133
}
132134

133135
func verifyEnvVar(key string) string {
@@ -140,8 +142,16 @@ func verifyEnvVar(key string) string {
140142

141143
func main() {
142144
loadEnvVars()
143-
p2pNetworkID = p2p.MainnetNetworkId
144-
p2pBootstrap = p2p.MainnetBootstrapPeers
145+
if network == "mainnet" {
146+
p2pNetworkID = p2p.MainnetNetworkId
147+
p2pBootstrap = p2p.MainnetBootstrapPeers
148+
} else if network == "testnet" {
149+
p2pNetworkID = p2p.TestnetNetworkId
150+
p2pBootstrap = p2p.TestnetBootstrapPeers
151+
} else {
152+
p2pNetworkID = p2p.DevnetNetworkId
153+
p2pBootstrap = ""
154+
}
145155

146156
lvl, err := ipfslog.LevelFromString(logLevel)
147157
if err != nil {

0 commit comments

Comments
 (0)