From 4ce687f29ae8804b9b18b0684e0b9b9e51145b62 Mon Sep 17 00:00:00 2001 From: Grant Linville Date: Mon, 4 Nov 2024 10:49:55 -0500 Subject: [PATCH] chore: add postgres credential helper (#891) Signed-off-by: Grant Linville --- pkg/config/cliconfig.go | 5 +++-- pkg/credentials/util.go | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/config/cliconfig.go b/pkg/config/cliconfig.go index d0ef00c8..215e2f39 100644 --- a/pkg/config/cliconfig.go +++ b/pkg/config/cliconfig.go @@ -22,14 +22,15 @@ const ( PassCredHelper = "pass" FileCredHelper = "file" SqliteCredHelper = "sqlite" + PostgresCredHelper = "postgres" GPTScriptHelperPrefix = "gptscript-credential-" ) var ( - darwinHelpers = []string{OsxkeychainCredHelper, FileCredHelper, SqliteCredHelper} + darwinHelpers = []string{OsxkeychainCredHelper, FileCredHelper, SqliteCredHelper, PostgresCredHelper} windowsHelpers = []string{WincredCredHelper, FileCredHelper} - linuxHelpers = []string{SecretserviceCredHelper, PassCredHelper, FileCredHelper, SqliteCredHelper} + linuxHelpers = []string{SecretserviceCredHelper, PassCredHelper, FileCredHelper, SqliteCredHelper, PostgresCredHelper} ) func listAsString(helpers []string) string { diff --git a/pkg/credentials/util.go b/pkg/credentials/util.go index 72f9eab9..2a4ad96b 100644 --- a/pkg/credentials/util.go +++ b/pkg/credentials/util.go @@ -14,8 +14,8 @@ type CredentialHelperDirs struct { func RepoNameForCredentialStore(store string) string { switch store { - case config.SqliteCredHelper: - return "gptscript-credential-sqlite" + case config.SqliteCredHelper, config.PostgresCredHelper: + return "gptscript-credential-database" default: return "gptscript-credential-helpers" } @@ -23,8 +23,8 @@ func RepoNameForCredentialStore(store string) string { func GitURLForRepoName(repoName string) (string, error) { switch repoName { - case "gptscript-credential-sqlite": - return runtimeEnv.VarOrDefault("GPTSCRIPT_CRED_SQLITE_ROOT", "https://github.com/gptscript-ai/gptscript-credential-sqlite.git"), nil + case "gptscript-credential-database": + return runtimeEnv.VarOrDefault("GPTSCRIPT_CRED_SQLITE_ROOT", "https://github.com/gptscript-ai/gptscript-credential-database.git"), nil case "gptscript-credential-helpers": return runtimeEnv.VarOrDefault("GPTSCRIPT_CRED_HELPERS_ROOT", "https://github.com/gptscript-ai/gptscript-credential-helpers.git"), nil default: