mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-06-03 01:44:53 +00:00
art: Make linter happy
This commit is contained in:
parent
7052c49621
commit
7ac3c30747
@ -73,7 +73,7 @@ func Run(opts ...Option) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = bus.Manager.Publish(events.EventBootstrap, events.BootstrapPayload{APIAddress: o.ApiAddress, Config: c.String(), Logfile: fileName})
|
_, err = bus.Manager.Publish(events.EventBootstrap, events.BootstrapPayload{APIAddress: o.APIAddress, Config: c.String(), Logfile: fileName})
|
||||||
|
|
||||||
if o.Restart && err != nil {
|
if o.Restart && err != nil {
|
||||||
fmt.Println("Warning: Agent failed, restarting: ", err.Error())
|
fmt.Println("Warning: Agent failed, restarting: ", err.Error())
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package agent
|
package agent
|
||||||
|
|
||||||
// Options yields the options for the running agent
|
// Options yields the options for the running agent.
|
||||||
type Options struct {
|
type Options struct {
|
||||||
ApiAddress string
|
APIAddress string
|
||||||
Dir []string
|
Dir []string
|
||||||
Force bool
|
Force bool
|
||||||
Restart bool
|
Restart bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply applies option to the options struct
|
// Apply applies option to the options struct.
|
||||||
func (o *Options) Apply(opts ...Option) error {
|
func (o *Options) Apply(opts ...Option) error {
|
||||||
for _, oo := range opts {
|
for _, oo := range opts {
|
||||||
if err := oo(o); err != nil {
|
if err := oo(o); err != nil {
|
||||||
@ -18,30 +18,30 @@ func (o *Options) Apply(opts ...Option) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Option is a generic option for the Agent
|
// Option is a generic option for the Agent.
|
||||||
type Option func(o *Options) error
|
type Option func(o *Options) error
|
||||||
|
|
||||||
// ForceAgent forces the agent to run
|
// ForceAgent forces the agent to run.
|
||||||
var ForceAgent Option = func(o *Options) error {
|
var ForceAgent Option = func(o *Options) error {
|
||||||
o.Force = true
|
o.Force = true
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// RestartAgent makes the agent restart on error
|
// RestartAgent makes the agent restart on error.
|
||||||
var RestartAgent Option = func(o *Options) error {
|
var RestartAgent Option = func(o *Options) error {
|
||||||
o.Restart = true
|
o.Restart = true
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithAPI sets the API address
|
// WithAPI sets the API address used to talk to EdgeVPN and co-ordinate node bootstrapping.
|
||||||
func WithAPI(address string) Option {
|
func WithAPI(address string) Option {
|
||||||
return func(o *Options) error {
|
return func(o *Options) error {
|
||||||
o.ApiAddress = address
|
o.APIAddress = address
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithDirectory sets the Agent config directories
|
// WithDirectory sets the Agent config directories.
|
||||||
func WithDirectory(dirs ...string) Option {
|
func WithDirectory(dirs ...string) Option {
|
||||||
return func(o *Options) error {
|
return func(o *Options) error {
|
||||||
o.Dir = dirs
|
o.Dir = dirs
|
||||||
|
Loading…
Reference in New Issue
Block a user