feat: add Smart Fridge shell and per-credential shell routing
Implement Samsung FridgeOS-themed shell (PLAN.md §3.3) with inventory management, temperature controls, diagnostics, alerts, and other appliance commands. Add per-credential shell routing so static credentials can specify which shell to use via the `shell` config field, passed through ssh.Permissions.Extensions. Also extract shared ReadLine helper from bash to the shell package so both shells can reuse terminal input handling. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -255,6 +255,33 @@ listen_addr = ":9090"
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadCredentialWithShell(t *testing.T) {
|
||||
content := `
|
||||
[[auth.static_credentials]]
|
||||
username = "samsung"
|
||||
password = "fridge"
|
||||
shell = "fridge"
|
||||
|
||||
[[auth.static_credentials]]
|
||||
username = "root"
|
||||
password = "toor"
|
||||
`
|
||||
path := writeTemp(t, content)
|
||||
cfg, err := Load(path)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
if len(cfg.Auth.StaticCredentials) != 2 {
|
||||
t.Fatalf("static_credentials len = %d, want 2", len(cfg.Auth.StaticCredentials))
|
||||
}
|
||||
if cfg.Auth.StaticCredentials[0].Shell != "fridge" {
|
||||
t.Errorf("cred[0].Shell = %q, want %q", cfg.Auth.StaticCredentials[0].Shell, "fridge")
|
||||
}
|
||||
if cfg.Auth.StaticCredentials[1].Shell != "" {
|
||||
t.Errorf("cred[1].Shell = %q, want empty", cfg.Auth.StaticCredentials[1].Shell)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadMissingFile(t *testing.T) {
|
||||
_, err := Load("/nonexistent/path/config.toml")
|
||||
if err == nil {
|
||||
|
||||
Reference in New Issue
Block a user