Skip to content

Commit

Permalink
Merge branch 'master' into graph
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Castell authored Mar 21, 2019
2 parents 5c90798 + 572b4bb commit 094f2a7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 8 additions & 4 deletions dkron/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,15 @@ func (a *Agent) SetConfig(c *Config) {

func (a *Agent) StartServer() {
if a.Store == nil {
var sConfig *store.Config
if a.config.Backend == store.BOLTDB || a.config.Backend == store.DYNAMODB {
sConfig = &store.Config{Bucket: a.config.Keyspace}
var sConfig = store.Config{}
backend := a.config.Backend
switch backend {
case store.BOLTDB, store.DYNAMODB:
sConfig.Bucket = a.config.Keyspace
case store.REDIS:
sConfig.Password = a.config.BackendPassword
}
a.Store = NewStore(a.config.Backend, a.config.BackendMachines, a, a.config.Keyspace, sConfig)
a.Store = NewStore(a.config.Backend, a.config.BackendMachines, a, a.config.Keyspace, &sConfig)
if err := a.Store.Healthy(); err != nil {
log.WithError(err).Fatal("store: Store backend not reachable")
}
Expand Down
3 changes: 3 additions & 0 deletions dkron/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Config struct {
HTTPAddr string `mapstructure:"http-addr"`
Backend store.Backend
BackendMachines []string `mapstructure:"backend-machine"`
BackendPassword string `mapstructure:"backend-password"`
Profile string
Interface string
AdvertiseAddr string `mapstructure:"advertise-addr"`
Expand Down Expand Up @@ -76,6 +77,7 @@ func DefaultConfig() *Config {
HTTPAddr: ":8080",
Backend: "boltdb",
BackendMachines: []string{"./dkron.db"},
BackendPassword: "",
Profile: "lan",
Keyspace: "dkron",
LogLevel: "info",
Expand All @@ -97,6 +99,7 @@ func ConfigFlagSet() *flag.FlagSet {
cmdFlags.String("http-addr", c.HTTPAddr, "Address to bind the UI web server to. Only used when server")
cmdFlags.String("backend", string(c.Backend), "Store backend (etcd|etcdv3|consul|zk|redis|boltdb|dynamodb)")
cmdFlags.StringSlice("backend-machine", c.BackendMachines, "Store backend machines addresses")
cmdFlags.String("backend-password", c.BackendPassword, "Store backend machines password only use redis")
cmdFlags.String("profile", c.Profile, "Profile is used to control the timing profiles used")
cmdFlags.StringSlice("join", []string{}, "An initial agent to join with. This flag can be specified multiple times")
cmdFlags.StringSlice("tag", []string{}, "Tag can be specified multiple times to attach multiple key/value tag pairs to the given node, specified as key=value")
Expand Down

0 comments on commit 094f2a7

Please sign in to comment.