2019-01-05 22:44:33 +00:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/filebrowser/filebrowser/v2/storage/bolt/importer"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
rootCmd.AddCommand(importCmd)
|
|
|
|
|
|
|
|
importCmd.Flags().String("old.database", "", "")
|
|
|
|
importCmd.Flags().String("old.config", "", "")
|
|
|
|
importCmd.MarkFlagRequired("old.database")
|
|
|
|
}
|
|
|
|
|
|
|
|
var importCmd = &cobra.Command{
|
|
|
|
Use: "import",
|
|
|
|
Short: "Imports an old configuration",
|
2019-01-05 23:01:16 +00:00
|
|
|
Long: `Imports an old configuration. This command DOES NOT
|
2019-01-05 22:44:33 +00:00
|
|
|
import share links because they are incompatible with
|
|
|
|
this version.`,
|
2019-01-05 23:01:16 +00:00
|
|
|
Args: cobra.NoArgs,
|
2019-01-05 22:44:33 +00:00
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
oldDB := mustGetString(cmd, "old.database")
|
|
|
|
oldConf := mustGetString(cmd, "old.config")
|
|
|
|
|
|
|
|
err := importer.Import(oldDB, oldConf, databasePath)
|
|
|
|
checkErr(err)
|
|
|
|
},
|
|
|
|
}
|