mirror of
https://github.com/getcompanion-ai/computer-host.git
synced 2026-04-17 20:05:03 +00:00
chore: zsh prompt alignment
This commit is contained in:
parent
3eb610b703
commit
39f8882c30
8 changed files with 56 additions and 11 deletions
|
|
@ -251,9 +251,13 @@ func (d *Daemon) mergedGuestConfig(config *contracthost.GuestConfig) (*contracth
|
|||
}
|
||||
|
||||
merged := &contracthost.GuestConfig{
|
||||
Hostname: "",
|
||||
AuthorizedKeys: authorizedKeys,
|
||||
TrustedUserCAKeys: nil,
|
||||
}
|
||||
if config != nil {
|
||||
merged.Hostname = strings.TrimSpace(config.Hostname)
|
||||
}
|
||||
if strings.TrimSpace(d.config.GuestLoginCAPublicKey) != "" {
|
||||
merged.TrustedUserCAKeys = append(merged.TrustedUserCAKeys, d.config.GuestLoginCAPublicKey)
|
||||
}
|
||||
|
|
@ -447,6 +451,21 @@ func validateGuestConfig(config *contracthost.GuestConfig) error {
|
|||
if config == nil {
|
||||
return nil
|
||||
}
|
||||
if config.Hostname != "" {
|
||||
hostname := strings.TrimSpace(config.Hostname)
|
||||
if hostname == "" {
|
||||
return fmt.Errorf("guest_config.hostname is required")
|
||||
}
|
||||
if len(hostname) > 63 {
|
||||
return fmt.Errorf("guest_config.hostname must be 63 characters or fewer")
|
||||
}
|
||||
if strings.ContainsAny(hostname, "/\\") {
|
||||
return fmt.Errorf("guest_config.hostname must not contain path separators")
|
||||
}
|
||||
if strings.ContainsAny(hostname, " \t\r\n") {
|
||||
return fmt.Errorf("guest_config.hostname must not contain whitespace")
|
||||
}
|
||||
}
|
||||
for i, key := range config.AuthorizedKeys {
|
||||
if strings.TrimSpace(key) == "" {
|
||||
return fmt.Errorf("guest_config.authorized_keys[%d] is required", i)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue