mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-21 23:20:24 +00:00
revertprovider: only accept the supported version
This commit is contained in:
parent
d32b195a57
commit
8de7a81674
1 changed files with 6 additions and 1 deletions
|
@ -26,11 +26,15 @@ Please take a look at the usage below to customize the options.`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
logger.DisableLogger()
|
logger.DisableLogger()
|
||||||
logger.EnableConsoleLogger(zerolog.DebugLevel)
|
logger.EnableConsoleLogger(zerolog.DebugLevel)
|
||||||
|
if revertProviderTargetVersion != 4 {
|
||||||
|
logger.WarnToConsole("Unsupported target version, 4 is the only supported one")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
configDir = utils.CleanDirInput(configDir)
|
configDir = utils.CleanDirInput(configDir)
|
||||||
err := config.LoadConfig(configDir, configFile)
|
err := config.LoadConfig(configDir, configFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.WarnToConsole("Unable to initialize data provider, config load error: %v", err)
|
logger.WarnToConsole("Unable to initialize data provider, config load error: %v", err)
|
||||||
return
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
kmsConfig := config.GetKMSConfig()
|
kmsConfig := config.GetKMSConfig()
|
||||||
err = kmsConfig.Initialize()
|
err = kmsConfig.Initialize()
|
||||||
|
@ -54,6 +58,7 @@ Please take a look at the usage below to customize the options.`,
|
||||||
func init() {
|
func init() {
|
||||||
addConfigFlags(revertProviderCmd)
|
addConfigFlags(revertProviderCmd)
|
||||||
revertProviderCmd.Flags().IntVar(&revertProviderTargetVersion, "to-version", 0, `4 means the version supported in v1.0.0-v1.2.x`)
|
revertProviderCmd.Flags().IntVar(&revertProviderTargetVersion, "to-version", 0, `4 means the version supported in v1.0.0-v1.2.x`)
|
||||||
|
revertProviderCmd.MarkFlagRequired("to-version") //nolint:errcheck
|
||||||
|
|
||||||
rootCmd.AddCommand(revertProviderCmd)
|
rootCmd.AddCommand(revertProviderCmd)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue