adept/cmd/setup.go
Gregory Ballantine 4d77a0e2bc
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Separated the repository initialization into a separate sub-command
2022-09-15 10:04:39 -04:00

35 lines
810 B
Go

package cmd
import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"git.metaunix.net/BitGoblin/adept/config"
"git.metaunix.net/BitGoblin/adept/transcoder"
)
// initializes the sub-command
func init() {
rootCmd.AddCommand(setupCmd)
}
var setupCmd = &cobra.Command{
Use: "setup",
Short: "Initialize the video directories.",
Long: `Adept can't run if it doesn't have a place to ingest/transcode files from.`,
Run: func(cmd *cobra.Command, args []string) {
// load configuration via Viper
config.LoadConfig()
// configure our app logging
logHandle := config.InitLogging()
if logHandle != nil {
defer logHandle.Close()
}
// initialize the video repository
r := transcoder.NewRepository(viper.GetString("transcoder.repository"))
r.Setup()
},
}