filebrowser/cmd/upgrade.go
Henrique Dias f396602084 feat: rename import to upgrade
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
2019-01-07 19:22:32 +00:00

32 lines
811 B
Go

package cmd
import (
"github.com/filebrowser/filebrowser/v2/storage/bolt/importer"
"github.com/spf13/cobra"
v "github.com/spf13/viper"
)
func init() {
rootCmd.AddCommand(upgradeCmd)
upgradeCmd.Flags().String("old.database", "", "")
upgradeCmd.Flags().String("old.config", "", "")
upgradeCmd.MarkFlagRequired("old.database")
}
var upgradeCmd = &cobra.Command{
Use: "upgrade",
Short: "Upgrades an old configuration",
Long: `Upgrades an old configuration. This command DOES NOT
import share links because they are incompatible with
this version.`,
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
oldDB := mustGetString(cmd, "old.database")
oldConf := mustGetString(cmd, "old.config")
err := importer.Import(oldDB, oldConf, v.GetString("database"))
checkErr(err)
},
}