feat(config): add links and dns settings
- links: short names mapped to host selectors, validated against chains and static host names - dns.suggest / dns.save_link: ask, always or never - dns.domains: domain rules per name pattern (mx* -> easysahre.de) - the wizard edits the dns settings under Resolver & cache and keeps links; setup.SaveTo reports to a chosen writer Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c408d529a0
commit
5c41a5eb6f
6 files changed
+290
-6
No files matched your search
@@ -26,7 +26,12 @@ type Config struct {
|
||||
Hosts []StaticHost `mapstructure:"hosts"`
|
||||
// Groups name lists of hosts and selectors for netssh multi (@name).
|
||||
Groups map[string][]string `mapstructure:"groups"`
|
||||
Multi MultiConfig `mapstructure:"multi"`
|
||||
// Links map a short name to a host selector: netssh NAME connects to it,
|
||||
// and the shell gets an alias NAME. Created after a DNS suggestion or
|
||||
// with netssh link add.
|
||||
Links map[string]string `mapstructure:"links"`
|
||||
DNS DNSConfig `mapstructure:"dns"`
|
||||
Multi MultiConfig `mapstructure:"multi"`
|
||||
}
|
||||
|
||||
type ShellConfig struct {
|
||||
@@ -185,7 +190,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.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", "ssh.warn_status", "tui.columns", "tui.reachability_timeout", "resolver.fallback", "resolver.fallback_timeout"} {
|
||||
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", "ssh.warn_status", "tui.columns", "tui.reachability_timeout", "resolver.fallback", "resolver.fallback_timeout", "dns.suggest", "dns.save_link"} {
|
||||
if err := v.BindEnv(key); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -239,6 +244,12 @@ func Load() (*Config, error) {
|
||||
if err := cfg.ValidateHosts(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := cfg.ValidateLinks(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := cfg.ValidateDNS(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := cfg.ValidateOperations(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user