mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-05-12 18:34:27 +00:00
art: Make linter happy
This commit is contained in:
parent
7052c49621
commit
7ac3c30747
internal/agent
@ -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 {
|
||||
fmt.Println("Warning: Agent failed, restarting: ", err.Error())
|
||||
|
@ -1,14 +1,14 @@
|
||||
package agent
|
||||
|
||||
// Options yields the options for the running agent
|
||||
// Options yields the options for the running agent.
|
||||
type Options struct {
|
||||
ApiAddress string
|
||||
APIAddress string
|
||||
Dir []string
|
||||
Force bool
|
||||
Restart bool
|
||||
}
|
||||
|
||||
// Apply applies option to the options struct
|
||||
// Apply applies option to the options struct.
|
||||
func (o *Options) Apply(opts ...Option) error {
|
||||
for _, oo := range opts {
|
||||
if err := oo(o); err != nil {
|
||||
@ -18,30 +18,30 @@ func (o *Options) Apply(opts ...Option) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Option is a generic option for the Agent
|
||||
// Option is a generic option for the Agent.
|
||||
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 {
|
||||
o.Force = true
|
||||
return nil
|
||||
}
|
||||
|
||||
// RestartAgent makes the agent restart on error
|
||||
// RestartAgent makes the agent restart on error.
|
||||
var RestartAgent Option = func(o *Options) error {
|
||||
o.Restart = true
|
||||
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 {
|
||||
return func(o *Options) error {
|
||||
o.ApiAddress = address
|
||||
o.APIAddress = address
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithDirectory sets the Agent config directories
|
||||
// WithDirectory sets the Agent config directories.
|
||||
func WithDirectory(dirs ...string) Option {
|
||||
return func(o *Options) error {
|
||||
o.Dir = dirs
|
||||
|
Loading…
Reference in New Issue
Block a user