feat: add host actions, lifecycle hooks and operational tools
This commit is contained in:
1 parent
8d4915543e
commit
e5bde9c61f
32 files changed
+2083
-64
No files matched your search
@@ -11,6 +11,8 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
TUI TUIConfig `mapstructure:"tui"`
|
||||
Activity ActivityConfig `mapstructure:"activity"`
|
||||
Commands map[string]HostCommand `mapstructure:"commands"`
|
||||
Shell ShellConfig `mapstructure:"shell"`
|
||||
NetBox NetBoxConfig `mapstructure:"netbox"`
|
||||
@@ -113,6 +115,9 @@ func Load() (*Config, error) {
|
||||
v.SetDefault("resolver.strategies", []string{"management_subnet", "primary_ip"})
|
||||
v.SetDefault("resolver.management_subnets", []string{})
|
||||
v.SetDefault("cache.ttl", 3600)
|
||||
v.SetDefault("tui.history_limit", 10)
|
||||
v.SetDefault("activity.retention_days", 30)
|
||||
v.SetDefault("activity.max_entries", 1000)
|
||||
|
||||
configDir, err := os.UserConfigDir()
|
||||
if err == nil {
|
||||
@@ -126,7 +131,7 @@ func Load() (*Config, error) {
|
||||
v.SetEnvPrefix("NETSSH")
|
||||
v.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
||||
v.AutomaticEnv()
|
||||
for _, key := range []string{"netbox.url", "netbox.token", "netbox.token_version", "resolver.strategies", "resolver.management_subnets", "resolver.interface_name", "resolver.hostname_domain", "cache.ttl", "cache.path", "ssh.default_user", "ssh.default_port", "shortcuts.domains", "shortcuts.strip_hyphens", "shortcuts.show", "shell.alias", "ssh.proxy_jump", "ssh.pre_connect", "ssh.host_key_checking", "ssh.target", "ssh.address_family", "completion.max_results", "multi.multiplexer", "multi.panes_per_window"} {
|
||||
for _, key := range []string{"netbox.url", "netbox.token", "netbox.token_version", "resolver.strategies", "resolver.management_subnets", "resolver.interface_name", "resolver.hostname_domain", "cache.ttl", "cache.path", "ssh.default_user", "ssh.default_port", "shortcuts.domains", "shortcuts.strip_hyphens", "shortcuts.show", "shell.alias", "ssh.proxy_jump", "ssh.pre_connect", "ssh.post_disconnect", "tui.history_limit", "activity.enabled", "activity.retention_days", "activity.max_entries", "ssh.host_key_checking", "ssh.target", "ssh.address_family", "completion.max_results", "multi.multiplexer", "multi.panes_per_window"} {
|
||||
if err := v.BindEnv(key); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -172,6 +177,9 @@ func Load() (*Config, error) {
|
||||
if err := cfg.ValidateHosts(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := cfg.ValidateOperations(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := cfg.ValidateCommands(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user