Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions App/AppState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@ final class AppState {
}
}

/// A user-configured binary path from settings, or nil to auto-detect (empty = auto).
static func storedPath(_ key: String) -> String? {
let value = UserDefaults.standard.string(forKey: key)
return (value?.isEmpty == false) ? value : nil
}

init(
containerEngine: ContainerEngine = SDKContainerEngine(),
composeEngine: ComposeEngine = CLIComposeEngine(),
serviceHealth: ServiceHealthChecking = CLIServiceHealth(),
creator: ContainerCreating = CLIContainerCreator(),
composeEngine: ComposeEngine = CLIComposeEngine(binaryPath: AppState.storedPath("composeBinaryPath")),
serviceHealth: ServiceHealthChecking = CLIServiceHealth(binaryPath: AppState.storedPath("containerBinaryPath")),
creator: ContainerCreating = CLIContainerCreator(binaryPath: AppState.storedPath("containerBinaryPath")),
store: RegistryStore = RegistryStore()
) {
self.containerEngine = containerEngine
Expand Down
13 changes: 13 additions & 0 deletions App/Views/SettingsWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ struct SettingsWindow: View {
@AppStorage("pollOpen") private var pollOpen = 2.0
@AppStorage("pollClosed") private var pollClosed = 15.0
@AppStorage("groupByNamePrefix") private var groupByNamePrefix = false
@AppStorage("containerBinaryPath") private var containerBinaryPath = ""
@AppStorage("composeBinaryPath") private var composeBinaryPath = ""
@State private var working = false

var body: some View {
Expand Down Expand Up @@ -39,6 +41,17 @@ struct SettingsWindow: View {
}
}

Section("Binaries") {
LabeledContent("container") {
TextField("auto-detected", text: $containerBinaryPath).frame(maxWidth: 240)
}
LabeledContent("container-compose") {
TextField("auto-detected", text: $composeBinaryPath).frame(maxWidth: 240)
}
Text("Override only if your binaries aren't in a standard location. Empty = auto-detect. Applies on relaunch.")
.font(.caption).foregroundStyle(.secondary)
}

Section("Stacks") {
Toggle("Group external containers by name prefix", isOn: $groupByNamePrefix)
Text("Off: only stacks you launch through Consai are grouped (reliable). On: containers that share a `name-` prefix are grouped as inferred stacks — can mis-group unrelated containers.")
Expand Down
Loading