remove reading data provider username and password from file
This reverts #1455 because the contributor cannot sign the CLA Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
parent
590a1f1429
commit
26d19abf61
4 changed files with 3 additions and 27 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -198,9 +198,7 @@
|
|||
"host": "",
|
||||
"port": 0,
|
||||
"username": "",
|
||||
"username_file": "",
|
||||
"password": "",
|
||||
"password_file": "",
|
||||
"sslmode": 0,
|
||||
"disable_sni": false,
|
||||
"target_session_attrs": "",
|
||||
|
|
Loading…
Reference in a new issue