Skip to content

Commit

Permalink
chore: add postgres credential helper (gptscript-ai#891)
Browse files Browse the repository at this point in the history
Signed-off-by: Grant Linville <grant@acorn.io>
  • Loading branch information
g-linville authored Nov 4, 2024
1 parent bda5f60 commit 4ce687f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions pkg/config/cliconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions pkg/credentials/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ 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"
}
}

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:
Expand Down

0 comments on commit 4ce687f

Please sign in to comment.