Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Enable separate external/internal location
Browse files Browse the repository at this point in the history
  • Loading branch information
jbygdell committed Dec 2, 2022
1 parent a65aee2 commit 0755980
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func NewConfig(app string) (*Config, error) {
}
case "sync":
requiredConfVars = []string{
"broker.host", "broker.port", "broker.user", "broker.password", "broker.routingkey", "db.host", "db.port", "db.user", "db.password", "db.database", "sync.host", "sync.password", "sync.user",
"broker.host", "broker.port", "broker.user", "broker.password", "broker.routingkey",
}
default:
requiredConfVars = []string{
Expand Down Expand Up @@ -234,17 +234,21 @@ func NewConfig(app string) (*Config, error) {

return c, nil
case "sync":
err = c.configDatabase()
if err != nil {
return nil, err
if viper.IsSet("db.host") {
err = c.configDatabase()
if err != nil {
return nil, err
}
}

err = c.configAPI()
if err != nil {
return nil, err
}

c.configSync()
if viper.IsSet("sync.host") {
c.configSync()
}

return c, nil
}
Expand Down

0 comments on commit 0755980

Please sign in to comment.