Skip to content

Commit

Permalink
chore: add postgres credential helper
Browse files Browse the repository at this point in the history
Signed-off-by: Grant Linville <[email protected]>
  • Loading branch information
g-linville committed Nov 1, 2024
1 parent 886f944 commit 36608e5
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 36608e5

Please sign in to comment.