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
@@ -0,0 +1,34 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type TUIConfig struct {
|
||||
HistoryLimit int `mapstructure:"history_limit"`
|
||||
}
|
||||
type ActivityConfig struct {
|
||||
Enabled bool `mapstructure:"enabled"`
|
||||
RetentionDays int `mapstructure:"retention_days"`
|
||||
MaxEntries int `mapstructure:"max_entries"`
|
||||
}
|
||||
|
||||
func (c *Config) ValidateOperations() error {
|
||||
if c.TUI.HistoryLimit < 0 {
|
||||
return fmt.Errorf("tui.history_limit must be >= 0 (0 = all)")
|
||||
}
|
||||
if c.Activity.RetentionDays < 0 || c.Activity.MaxEntries < 0 {
|
||||
return fmt.Errorf("activity retention_days and max_entries must be >= 0")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m SSHMatch) Matches(host SSHHost) bool { return m == (SSHMatch{}) || m.matches(host) }
|
||||
func (c HostCommand) Allowed(host SSHHost) bool { return c.Match.Matches(host) }
|
||||
func HookCommand(s string) string {
|
||||
s = strings.TrimSpace(s)
|
||||
if strings.EqualFold(s, "none") {
|
||||
return ""
|
||||
}
|
||||
return s
|
||||
}
|
||||
Reference in new issue
Block a user