go-waku/cmd/waku/main.go

119 lines
2.2 KiB
Go
Raw Normal View History

2022-11-26 15:57:11 +00:00
package main
import (
"os"
2023-01-11 15:58:49 +00:00
cli "github.com/urfave/cli/v2"
"github.com/urfave/cli/v2/altsrc"
2022-11-26 15:57:11 +00:00
"github.com/waku-org/go-waku/waku"
"github.com/waku-org/go-waku/waku/v2/node"
)
var options waku.Options
func main() {
// Defaults
options.LogLevel = "INFO"
options.LogEncoding = "console"
cliFlags := []cli.Flag{
2023-01-11 15:58:49 +00:00
&cli.StringFlag{Name: "config-file", Usage: "loads configuration from a TOML file (cmd-line parameters take precedence)"},
TcpPort,
Address,
WebsocketSupport,
WebsocketPort,
WebsocketSecurePort,
WebsocketAddress,
WebsocketSecureSupport,
WebsocketSecureKeyPath,
WebsocketSecureCertPath,
Dns4DomainName,
NodeKey,
KeyFile,
KeyPassword,
GenerateKey,
Overwrite,
StaticNode,
KeepAlive,
PersistPeers,
NAT,
AdvertiseAddress,
ShowAddresses,
LogLevel,
LogEncoding,
LogOutput,
AgentString,
Relay,
Topics,
ProtectedTopics,
RelayPeerExchange,
MinRelayPeersToPublish,
StoreNodeFlag,
StoreFlag,
2022-12-09 19:26:24 +00:00
StoreMessageDBURL,
StoreMessageRetentionTime,
StoreMessageRetentionCapacity,
StoreResumePeer,
FilterFlag,
FilterNode,
FilterTimeout,
FilterLegacyFlag,
FilterLegacyNode,
FilterLegacyLightClient,
LightPush,
LightPushNode,
Discv5Discovery,
Discv5BootstrapNode,
Discv5UDPPort,
Discv5ENRAutoUpdate,
PeerExchange,
PeerExchangeNode,
DNSDiscovery,
DNSDiscoveryUrl,
DNSDiscoveryNameServer,
2023-03-09 15:48:25 +00:00
Rendezvous,
RendezvousNode,
2023-03-09 22:42:50 +00:00
RendezvousServer,
MetricsServer,
MetricsServerAddress,
MetricsServerPort,
RPCFlag,
RPCPort,
RPCAddress,
RPCRelayCacheCapacity,
RPCAdmin,
RPCPrivate,
RESTFlag,
RESTAddress,
RESTPort,
RESTRelayCacheCapacity,
RESTAdmin,
RESTPrivate,
PProf,
2022-11-26 15:57:11 +00:00
}
rlnFlags := rlnFlags()
cliFlags = append(cliFlags, rlnFlags...)
cli.VersionFlag = &cli.BoolFlag{
Name: "version",
Usage: "prints the version",
}
app := &cli.App{
Name: "gowaku",
Version: node.GetVersionInfo().String(),
2023-01-11 15:58:49 +00:00
Before: altsrc.InitInputSourceWithContext(cliFlags, altsrc.NewTomlSourceFromFlagFunc("config-file")),
2022-11-26 15:57:11 +00:00
Flags: cliFlags,
Action: func(c *cli.Context) error {
waku.Execute(options)
return nil
},
}
err := app.Run(os.Args)
if err != nil {
panic(err)
}
}