diff --git a/install.ps1 b/install.ps1 index f6c05ca..d61a13f 100644 --- a/install.ps1 +++ b/install.ps1 @@ -494,6 +494,7 @@ if ($ForceConfig -or -not (Test-Path $clientConfig)) { $defaultServer = if ($Server) { $Server } else { "user@example.com" } $updateRepo = if ($Repo) { $Repo } else { "https://git.palav.dev/Palav/dosh.git" } $doshHostLine = if ($DoshHost) { "dosh_host = `"$DoshHost`"" } else { "# dosh_host = `"public.example.com`"" } + $credentialCache = if ($env:LOCALAPPDATA) { (Join-Path $env:LOCALAPPDATA "dosh\credentials").Replace('\', '/') } else { "~/.local/share/dosh/credentials" } $clientToml = @" update_repo = "$updateRepo" update_port = $Port @@ -508,7 +509,7 @@ view_only = false predict = true predict_mode = "experimental" cache_attach_tickets = true -credential_cache = "~/.local/share/dosh/credentials" +credential_cache = "$credentialCache" auth_preference = "native,ssh" trust_on_first_use = false native_auth_timeout_ms = 700 diff --git a/tests/release_scripts.rs b/tests/release_scripts.rs index bd66142..edc9e50 100644 --- a/tests/release_scripts.rs +++ b/tests/release_scripts.rs @@ -350,6 +350,17 @@ fn installers_generate_same_native_auth_client_defaults() { } } +#[test] +fn windows_installer_uses_native_credential_cache_path() { + let install = include_str!("../install.sh"); + let ps1 = include_str!("../install.ps1"); + assert!(install.contains("credential_cache = \"~/.local/share/dosh/credentials\"")); + assert!(ps1.contains("$credentialCache = if ($env:LOCALAPPDATA)")); + assert!(ps1.contains("Join-Path $env:LOCALAPPDATA \"dosh\\credentials\"")); + assert!(ps1.contains(".Replace('\\', '/')")); + assert!(ps1.contains("credential_cache = \"$credentialCache\"")); +} + #[test] fn windows_installer_generates_hosts_config_like_unix() { let install = include_str!("../install.sh");