mirror of
https://github.com/ditatompel/xmr-remote-nodes.git
synced 2025-01-08 05:52:10 +07:00
Set ./cmd/server/admin.go
as entrypoint to server build
This commit is contained in:
parent
0f7029b939
commit
7b6cfee31d
5 changed files with 15 additions and 15 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"os"
|
||||
"strings"
|
||||
"syscall"
|
||||
"xmr-remote-nodes/cmd"
|
||||
"xmr-remote-nodes/internal/database"
|
||||
"xmr-remote-nodes/internal/repo"
|
||||
|
||||
|
@ -37,6 +38,16 @@ var AdminCmd = &cobra.Command{
|
|||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
cmd.Root.AddCommand(serveCmd)
|
||||
cmd.Root.AddCommand(importCmd)
|
||||
cmd.Root.AddCommand(probersCmd)
|
||||
probersCmd.AddCommand(listProbersCmd)
|
||||
probersCmd.AddCommand(addProbersCmd)
|
||||
listProbersCmd.Flags().StringP("sort-by", "s", "last_submit_ts", "Sort by column name, can be id or last_submit_ts")
|
||||
listProbersCmd.Flags().StringP("sort-dir", "d", "desc", "Sort direction, can be asc or desc")
|
||||
}
|
||||
|
||||
func createAdmin() error {
|
||||
admin := repo.NewAdminRepo(database.GetDB())
|
||||
a := repo.Admin{
|
||||
|
|
|
@ -25,7 +25,7 @@ type importData struct {
|
|||
DateEntered int `json:"date_entered"`
|
||||
}
|
||||
|
||||
var ImportCmd = &cobra.Command{
|
||||
var importCmd = &cobra.Command{
|
||||
Use: "import",
|
||||
Short: "Import Monero nodes from old API",
|
||||
Long: `Import Monero nodes from old API.
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"strings"
|
||||
"text/tabwriter"
|
||||
"time"
|
||||
"xmr-remote-nodes/cmd"
|
||||
"xmr-remote-nodes/internal/database"
|
||||
"xmr-remote-nodes/internal/repo"
|
||||
|
||||
|
@ -15,7 +14,7 @@ import (
|
|||
|
||||
var probersCmd = &cobra.Command{
|
||||
Use: "probers",
|
||||
Short: "[server] Add, edit, delete, and show registered probers",
|
||||
Short: "Add, edit, delete, and show registered probers",
|
||||
Long: `Command to administer prober machines.
|
||||
|
||||
This command should only be run on the server which directly connect to the MySQL database.
|
||||
|
@ -73,17 +72,9 @@ xmr-nodes probers list -s last_submit_ts -d asc sin1`,
|
|||
|
||||
var addProbersCmd = &cobra.Command{
|
||||
Use: "add [name]",
|
||||
Short: "[server] Add new prober",
|
||||
Short: "Add new prober",
|
||||
Long: `Add new prober machine.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("TODO: Add new prober")
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
cmd.Root.AddCommand(probersCmd)
|
||||
probersCmd.AddCommand(listProbersCmd)
|
||||
probersCmd.AddCommand(addProbersCmd)
|
||||
listProbersCmd.Flags().StringP("sort-by", "s", "last_submit_ts", "Sort by column name, can be id or last_submit_ts")
|
||||
listProbersCmd.Flags().StringP("sort-dir", "d", "desc", "Sort direction, can be asc or desc")
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var ServeCmd = &cobra.Command{
|
||||
var serveCmd = &cobra.Command{
|
||||
Use: "serve",
|
||||
Short: "Serve the WebUI",
|
||||
Long: `This command will run HTTP server for APIs and WebUI.`,
|
||||
|
|
|
@ -9,6 +9,4 @@ import (
|
|||
|
||||
func init() {
|
||||
cmd.Root.AddCommand(server.AdminCmd)
|
||||
cmd.Root.AddCommand(server.ServeCmd)
|
||||
cmd.Root.AddCommand(server.ImportCmd)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue