xmr-remote-nodes/cmd/cmd.go
Christian Ditaputratama 4c7d53547b
feat!: Change the module name to "URL based"
This make me easier to test the module with external services.
2024-07-07 01:28:44 +07:00

41 lines
804 B
Go

package cmd
import (
"os"
"github.com/ditatompel/xmr-remote-nodes/cmd/client"
"github.com/ditatompel/xmr-remote-nodes/internal/config"
"github.com/spf13/cobra"
)
var configFile string
var Root = &cobra.Command{
Use: "xmr-nodes",
Short: "XMR Nodes",
Version: config.Version,
}
func Execute() {
err := Root.Execute()
if err != nil {
os.Exit(1)
}
}
func init() {
cobra.OnInitialize(initConfig)
Root.PersistentFlags().StringVarP(&configFile, "config-file", "c", "", "Default to .env")
Root.AddCommand(client.ProbeCmd)
client.ProbeCmd.Flags().StringP("endpoint", "e", "", "Server endpoint")
client.ProbeCmd.Flags().Bool("no-tor", false, "Only probe clearnet nodes")
}
func initConfig() {
if configFile != "" {
config.LoadAll(configFile)
return
}
config.LoadAll(".env")
}