Skip to content

feat(auth/clerk): Update Clerk secret key names #137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 5, 2025
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
6 changes: 3 additions & 3 deletions auth/clerk/clerk.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (s *System) buildVault() (*Details, error) {
}

if s.Details.Key == "" {
secret, err := vh.GetSecret("clerk_key")
secret, err := vh.GetSecret("clerk-key")
if err != nil {
return clerk, err
}
Expand All @@ -77,9 +77,9 @@ func (s *System) buildVault() (*Details, error) {
}

if s.Details.PublicKey == "" {
secret, err := vh.GetSecret("clerk_public_key")
secret, err := vh.GetSecret("clerk-public-key")
if err != nil {
if err.Error() != fmt.Sprint("key: 'clerk_public_key' not found") {
if err.Error() != fmt.Sprint("key: 'clerk-public-key' not found") {
return clerk, err
}
}
Expand Down
10 changes: 5 additions & 5 deletions auth/clerk/clerk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ func TestBuildGeneric(t *testing.T) {
func TestBuildVault(t *testing.T) {
mockVault := &vaultHelper.MockVaultHelper{
KVSecrets: []vaultHelper.KVSecret{
{Key: "clerk_key", Value: "testKey"},
{Key: "clerk_public_key", Value: "testPublicKey"},
{Key: "clerk-key", Value: "testKey"},
{Key: "clerk-public-key", Value: "testPublicKey"},
},
}

Expand All @@ -46,8 +46,8 @@ func TestBuildVault(t *testing.T) {
func TestBuildVaultNoKey(t *testing.T) {
mockVault := &vaultHelper.MockVaultHelper{
KVSecrets: []vaultHelper.KVSecret{
{Key: "clerk_key", Value: "testKey"},
{Key: "clerk_public_key", Value: "testPublicKey"},
{Key: "clerk-key", Value: "testKey"},
{Key: "clerk-public-key", Value: "testPublicKey"},
},
}

Expand All @@ -66,7 +66,7 @@ func TestBuildVaultNoPublicKey(t *testing.T) {
os.Clearenv()
mockVault := &vaultHelper.MockVaultHelper{
KVSecrets: []vaultHelper.KVSecret{
{Key: "clerk_key", Value: "testKey"},
{Key: "clerk-key", Value: "testKey"},
},
}

Expand Down
4 changes: 2 additions & 2 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ func TestClerk(t *testing.T) {
t.Run("clerk with values", func(t *testing.T) {
mockVault := &MockVaultHelper{
KVSecrets: []vaulthelper.KVSecret{
{Key: "clerk_key", Value: "testKey"},
{Key: "clerk_public_key", Value: "testPublicKey"},
{Key: "clerk-key", Value: "testKey"},
{Key: "clerk-public-key", Value: "testPublicKey"},
},
}

Expand Down
4 changes: 4 additions & 0 deletions database/postgres/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"github.com/jackc/pgx/v5"
"strconv"
"strings"
"time"

"github.com/bugfixes/go-bugfixes/logs"
Expand Down Expand Up @@ -176,6 +177,9 @@ func (s *System) GetPGXClient(ctx context.Context) (*pgx.Conn, error) {

client, err := pgx.Connect(ctx, fmt.Sprintf("postgres://%s:%s@%s:%d/%s", s.Details.User, s.Details.Password, s.Details.Host, s.Details.Port, s.Details.DBName))
if err != nil {
if strings.Contains(err.Error(), "operation was canceled") {
return nil, err
}
return nil, logs.Errorf("failed to get db client: %v", err)
}

Expand Down
Loading