Remove app admin command

This commit is contained in:
Abhishek Shroff
2024-08-07 16:56:14 +05:30
parent d35561a0a2
commit 4e63e74888
5 changed files with 8 additions and 25 deletions

View File

@@ -1,19 +0,0 @@
package admincmd
import (
"github.com/shroff/phylum/server/internal/storage"
"github.com/spf13/cobra"
)
func SetupCommand(cs storage.Storage) *cobra.Command {
cmd := &cobra.Command{
Use: "admin",
Short: "Server Administration",
}
cmd.AddCommand([]*cobra.Command{
setupStorageCommand(cs),
setupUserCommand(),
}...)
return cmd
}

View File

@@ -2,7 +2,6 @@ package appcmd
import (
"github.com/shroff/phylum/server/internal/app"
"github.com/shroff/phylum/server/internal/command/appcmd/admincmd"
"github.com/shroff/phylum/server/internal/db"
"github.com/shroff/phylum/server/internal/storage"
"github.com/sirupsen/logrus"
@@ -42,9 +41,10 @@ func SetupCommand(db **db.DbHandler, debug bool) *cobra.Command {
viper.BindPFlag("content_dir", flags.Lookup("content-dir"))
cmd.AddCommand([]*cobra.Command{
admincmd.SetupCommand(cs),
setupServeCommand(),
setupUserCommand(),
setupResourceCommand(),
setupStorageCommand(cs),
}...)
return cmd

View File

@@ -1,4 +1,4 @@
package admincmd
package appcmd
import (
"bufio"

View File

@@ -1,4 +1,4 @@
package admincmd
package appcmd
import (
"context"

View File

@@ -52,8 +52,10 @@ func SetupCommand() {
}
defer func() {
logrus.Info("Shutting Down App")
database.Close()
if database != nil {
logrus.Info("Shutting Down App")
database.Close()
}
}()
rootCmd.AddCommand([]*cobra.Command{