forked from TrueCloudLab/frostfs-s3-gw
[#541] Fix setting of tls.enabled flag
Signed-off-by: Marina Biryukova <m.biryukova@yadro.com>
This commit is contained in:
parent
e7a8d4bdaf
commit
da77e426b6
3 changed files with 16 additions and 1 deletions
|
@ -931,13 +931,17 @@ func newViper(flags *pflag.FlagSet) (*viper.Viper, error) {
|
|||
v.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
||||
v.AllowEmptyEnv(true)
|
||||
|
||||
if err := bindFlags(v, flags); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
setDefaults(v, flags)
|
||||
|
||||
if v.IsSet(cfgServer+".0."+cfgTLSKeyFile) && v.IsSet(cfgServer+".0."+cfgTLSCertFile) {
|
||||
v.Set(cfgServer+".0."+cfgTLSEnabled, true)
|
||||
}
|
||||
|
||||
return v, bindFlags(v, flags)
|
||||
return v, nil
|
||||
}
|
||||
|
||||
func newSettings() *appCfg {
|
||||
|
|
|
@ -48,3 +48,12 @@ resolve_order:
|
|||
require.Equal(t, []string{resolver.DNSResolver}, cfg.config().GetStringSlice(cfgResolveOrder))
|
||||
require.Equal(t, 10, cfg.config().GetInt(cfgMaxClientsCount))
|
||||
}
|
||||
|
||||
func TestSetTLSEnabled(t *testing.T) {
|
||||
cfg := newSettings()
|
||||
|
||||
require.NoError(t, cfg.flags.Parse([]string{"--" + cfgTLSCertFile, "tls.crt", "--" + cfgTLSKeyFile, "tls.key"}))
|
||||
require.NoError(t, cfg.reload())
|
||||
|
||||
require.True(t, cfg.config().GetBool(cfgServer+".0."+cfgTLSEnabled))
|
||||
}
|
||||
|
|
|
@ -64,6 +64,8 @@ $ frostfs-s3-gw --listen_address 192.168.130.130:443 \
|
|||
|
||||
Using these flag you can configure only one address. To set multiple addresses use yaml config.
|
||||
|
||||
**Note:** It's not recommended to configure addresses via flags and yaml config at the same time.
|
||||
|
||||
### RPC endpoint and resolving of bucket names
|
||||
|
||||
To set RPC endpoint specify a value of parameter `-r` or `--rpc_endpoint`. The parameter is **required if** another
|
||||
|
|
Loading…
Add table
Reference in a new issue