diff --git a/internal/config/config.go b/internal/config/config.go index 92f368a9..545a7742 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -325,9 +325,7 @@ func Init() { Host: "", Port: 0, Username: "", - UsernameFile: "", Password: "", - PasswordFile: "", ConnectionString: "", SQLTablesPrefix: "", SSLMode: 0, @@ -2064,9 +2062,7 @@ func setViperDefaults() { viper.SetDefault("data_provider.host", globalConf.ProviderConf.Host) viper.SetDefault("data_provider.port", globalConf.ProviderConf.Port) viper.SetDefault("data_provider.username", globalConf.ProviderConf.Username) - viper.SetDefault("data_provider.username_file", globalConf.ProviderConf.UsernameFile) viper.SetDefault("data_provider.password", globalConf.ProviderConf.Password) - viper.SetDefault("data_provider.password_file", globalConf.ProviderConf.PasswordFile) viper.SetDefault("data_provider.sslmode", globalConf.ProviderConf.SSLMode) viper.SetDefault("data_provider.disable_sni", globalConf.ProviderConf.DisableSNI) viper.SetDefault("data_provider.target_session_attrs", globalConf.ProviderConf.TargetSessionAttrs) diff --git a/internal/dataprovider/dataprovider.go b/internal/dataprovider/dataprovider.go index baf70336..989db27e 100644 --- a/internal/dataprovider/dataprovider.go +++ b/internal/dataprovider/dataprovider.go @@ -392,11 +392,9 @@ type Config struct { // Database port Port int `json:"port" mapstructure:"port"` // Database username - Username string `json:"username" mapstructure:"username"` - UsernameFile string `json:"username_file" mapstructure:"username_file"` + Username string `json:"username" mapstructure:"username"` // Database password - Password string `json:"password" mapstructure:"password"` - PasswordFile string `json:"password_file" mapstructure:"password_file"` + Password string `json:"password" mapstructure:"password"` // Used for drivers mysql and postgresql. // 0 disable SSL/TLS connections. // 1 require ssl. @@ -915,22 +913,6 @@ func Initialize(cnf Config, basePath string, checkAdmins bool) error { config.Actions.ExecuteOn = util.RemoveDuplicates(config.Actions.ExecuteOn, true) config.Actions.ExecuteFor = util.RemoveDuplicates(config.Actions.ExecuteFor, true) - if config.UsernameFile != "" { - user, err := util.ReadConfigFromFile(config.UsernameFile, basePath) - if err != nil { - return err - } - config.Username = user - } - - if config.PasswordFile != "" { - password, err := util.ReadConfigFromFile(config.PasswordFile, basePath) - if err != nil { - return err - } - config.Password = password - } - cnf.BackupsPath = getConfigPath(cnf.BackupsPath, basePath) if cnf.BackupsPath == "" { return fmt.Errorf("required directory is invalid, backup path %q", cnf.BackupsPath) diff --git a/internal/sftpd/server.go b/internal/sftpd/server.go index 8b1f2eee..6493895f 100644 --- a/internal/sftpd/server.go +++ b/internal/sftpd/server.go @@ -523,7 +523,7 @@ func (c *Configuration) configureSecurityOptions(serverConfig *ssh.ServerConfig) } func (c *Configuration) configureLoginBanner(serverConfig *ssh.ServerConfig, configDir string) { - if len(c.LoginBannerFile) > 0 { + if c.LoginBannerFile != "" { bannerFilePath := c.LoginBannerFile if !filepath.IsAbs(bannerFilePath) { bannerFilePath = filepath.Join(configDir, bannerFilePath) diff --git a/sftpgo.json b/sftpgo.json index 5f02c585..41aeb77b 100644 --- a/sftpgo.json +++ b/sftpgo.json @@ -198,9 +198,7 @@ "host": "", "port": 0, "username": "", - "username_file": "", "password": "", - "password_file": "", "sslmode": 0, "disable_sni": false, "target_session_attrs": "",