chore: support single queue and multiple worker (#589)
This commit is contained in:
@@ -243,7 +243,7 @@ type SectionGRPC struct {
|
||||
}
|
||||
|
||||
// LoadConf load config from file and read in environment variables that match
|
||||
func LoadConf(confPath string) (ConfYaml, error) {
|
||||
func LoadConf(confPath ...string) (ConfYaml, error) {
|
||||
var conf ConfYaml
|
||||
|
||||
viper.SetConfigType("yaml")
|
||||
@@ -251,8 +251,8 @@ func LoadConf(confPath string) (ConfYaml, error) {
|
||||
viper.SetEnvPrefix("gorush") // will be uppercased automatically
|
||||
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
||||
|
||||
if confPath != "" {
|
||||
content, err := ioutil.ReadFile(confPath)
|
||||
if len(confPath) > 0 && confPath[0] != "" {
|
||||
content, err := ioutil.ReadFile(confPath[0])
|
||||
if err != nil {
|
||||
return conf, err
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ type ConfigTestSuite struct {
|
||||
|
||||
func (suite *ConfigTestSuite) SetupTest() {
|
||||
var err error
|
||||
suite.ConfGorushDefault, err = LoadConf("")
|
||||
suite.ConfGorushDefault, err = LoadConf()
|
||||
if err != nil {
|
||||
panic("failed to load default config.yml")
|
||||
}
|
||||
@@ -215,6 +215,6 @@ func TestLoadConfigFromEnv(t *testing.T) {
|
||||
|
||||
func TestLoadWrongDefaultYAMLConfig(t *testing.T) {
|
||||
defaultConf = []byte(`a`)
|
||||
_, err := LoadConf("")
|
||||
_, err := LoadConf()
|
||||
assert.Error(t, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user