101 lines
3.6 KiB
Go
101 lines
3.6 KiB
Go
package nitro
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/spf13/pflag"
|
|
)
|
|
|
|
// start flags are prefixed with the server name
|
|
func prefix(f string) string {
|
|
return fmt.Sprintf("%s.%s", serverName, f)
|
|
}
|
|
|
|
var (
|
|
flag_pk = prefix("pk") // "pk"
|
|
|
|
flag_eth_pk = prefix("eth-pk") // "chainpk"
|
|
flag_eth_url = prefix("eth-url") // "chainurl"
|
|
flag_eth_start_block = prefix("eth-start-block") // "chainstartblock"
|
|
flag_eth_auth_token = prefix("eth-auth-token") // "chainauthtoken"
|
|
flag_eth_na_address = prefix("eth-na-address") // "naaddress"
|
|
flag_eth_vpa_address = prefix("eth-vpa-address") // "vpaaddress"
|
|
flag_eth_ca_address = prefix("eth-ca-address") // "caaddress"
|
|
// flag_bridge_address = prefix("bridge-address") // "bridgeaddress"
|
|
|
|
flag_public_ip = prefix("public-ip") // "publicip"
|
|
flag_msg_port = prefix("msg-port") // "msgport"
|
|
flag_ws_msg_port = prefix("ws-msg-port") // "wsmsgport"
|
|
flag_rpc_port = prefix("rpc-port") // "rpcport"
|
|
flag_boot_peers = prefix("boot-peers") // "bootpeers"
|
|
flag_ext_multiaddr = prefix("ext-multiaddr") // "extmultiaddr"
|
|
flag_tls_cert_filepath = prefix("tls-cert-filepath") // "tlscertfilepath"
|
|
flag_tls_key_filepath = prefix("tls-key-filepath") // "tlskeyfilepath"
|
|
// flag_gui_port = prefix("gui-port") // "guiport"
|
|
)
|
|
|
|
// func addFlags(cmd *cobra.Command) {
|
|
// flags := cmd.Flags()
|
|
func AddNitroFlags(flags *pflag.FlagSet) {
|
|
flags.String(flag_pk, "",
|
|
"name of private key used by the Nitro node",
|
|
// EnvVars: []string{"SC_PK"},
|
|
)
|
|
flags.String(flag_eth_url, "ws://127.0.0.1:8545",
|
|
"URL of the Ethereum node to connect to",
|
|
// EnvVars: []string{"CHAIN_URL"},
|
|
)
|
|
flags.String(flag_eth_auth_token, "",
|
|
"bearer token used for auth in requests to the Ethereum chain's RPC endpoint",
|
|
// EnvVars: []string{"CHAIN_AUTH_TOKEN"},
|
|
)
|
|
flags.String(flag_eth_pk, "",
|
|
"name of private key to use when interacting with the Ethereum chain",
|
|
// EnvVars: []string{"CHAIN_PK"},
|
|
)
|
|
flags.Uint64(flag_eth_start_block, 0,
|
|
"Ethereum block number to start listening for Nitro Adjudicator events",
|
|
// EnvVars: []string{"CHAIN_START_BLOCK"},
|
|
)
|
|
flags.String(flag_eth_na_address, "",
|
|
"Ethereum address of the Nitro Adjudicator contract",
|
|
)
|
|
flags.String(flag_eth_vpa_address, "",
|
|
"Ethereum address of the Virtual Payment App contract",
|
|
)
|
|
flags.String(flag_eth_ca_address, "",
|
|
"Ethereum address of the Consensus App contract",
|
|
)
|
|
// flags.String(flag_bridge_address, "",
|
|
// "Specifies the address of the bridge contract.",
|
|
// )
|
|
flags.String(flag_public_ip, "127.0.0.1",
|
|
"public IP address used for the message service",
|
|
// EnvVars: []string{"NITRO_PUBLIC_IP"},
|
|
)
|
|
flags.String(flag_ext_multiaddr, "",
|
|
"additional external multiaddr to advertise",
|
|
)
|
|
flags.Int(flag_msg_port, 3005,
|
|
"TCP port for the message service",
|
|
)
|
|
flags.Int(flag_ws_msg_port, 6005,
|
|
"WebSocket port for the message service",
|
|
)
|
|
flags.Int(flag_rpc_port, 4005,
|
|
"TCP port for the RPC server",
|
|
)
|
|
// flags.Int(flag_gui_port, 5005,
|
|
// "Specifies the tcp port for the Nitro Connect GUI.",
|
|
// )
|
|
flags.String(flag_boot_peers, "",
|
|
"comma-delimited list of peer multiaddrs the messaging service will connect to when initialized",
|
|
)
|
|
flags.String(flag_tls_cert_filepath, "", // "./tls/statechannels.org.pem",
|
|
"filepath to the TLS certificate; if not specified, TLS will not be used with the RPC transport",
|
|
)
|
|
flags.String(flag_tls_key_filepath, "", // "./tls/statechannels.org_key.pem",
|
|
"filepath to the TLS private key; if not specified, TLS will not be used with the RPC transport",
|
|
)
|
|
}
|