mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
commands: initialize plugins if we have a KMS
this is necessary to be able to read KMS secrets stored within the data provider Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
"github.com/drakkan/sftpgo/v2/internal/config"
|
||||
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||
"github.com/drakkan/sftpgo/v2/internal/plugin"
|
||||
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||
)
|
||||
|
||||
@@ -56,6 +57,21 @@ Please take a look at the usage below to customize the options.`,
|
||||
logger.ErrorToConsole("unable to initialize KMS: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
if config.HasKMSPlugin() {
|
||||
if err := plugin.Initialize(config.GetPluginsConfig(), "debug"); err != nil {
|
||||
logger.ErrorToConsole("unable to initialize plugin system: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
registerSignals()
|
||||
defer plugin.Handler.Cleanup()
|
||||
}
|
||||
|
||||
mfaConfig := config.GetMFAConfig()
|
||||
err = mfaConfig.Initialize()
|
||||
if err != nil {
|
||||
logger.ErrorToConsole("Unable to initialize MFA: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
providerConf := config.GetProviderConf()
|
||||
logger.InfoToConsole("Reverting provider: %q config file: %q target version %d", providerConf.Driver,
|
||||
viper.ConfigFileUsed(), revertProviderTargetVersion)
|
||||
|
||||
Reference in New Issue
Block a user