Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

fix: remove unneeded gptscript dependency #6

Merged
merged 1 commit into from
Sep 23, 2024
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
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ require (
github.com/adrg/xdg v0.4.0
github.com/docker/docker-credential-helpers v0.8.2
github.com/glebarez/sqlite v1.11.0
github.com/gptscript-ai/gptscript v0.9.4
gorm.io/gorm v1.25.12
k8s.io/apimachinery v0.31.1
k8s.io/apiserver v0.31.1
Expand All @@ -20,7 +19,6 @@ require (
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/docker/cli v26.0.0+incompatible // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/docker/cli v26.0.0+incompatible h1:90BKrx1a1HKYpSnnBFR6AgDq/FqkHxwlUyzJVPxD30I=
github.com/docker/cli v26.0.0+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
github.com/docker/docker-credential-helpers v0.8.2 h1:bX3YxiGzFP5sOXWc3bTPEXdEaZSeVMrFgOr3T+zrFAo=
github.com/docker/docker-credential-helpers v0.8.2/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
Expand Down Expand Up @@ -67,8 +65,6 @@ github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af h1:kmjWCqn2qkEml422C2
github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gptscript-ai/gptscript v0.9.4 h1:8msPI7zdzNv6kElLqP/mIFFoir2CWbyf+1OJiC479FY=
github.com/gptscript-ai/gptscript v0.9.4/go.mod h1:STd/eyhAkkC0YUL8B0tBs15m+uxm7yliur8HicZJL68=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
Expand Down
19 changes: 5 additions & 14 deletions pkg/sqlite/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/adrg/xdg"
"github.com/docker/docker-credential-helpers/credentials"
"github.com/glebarez/sqlite"
"github.com/gptscript-ai/gptscript/pkg/config"
"gorm.io/gorm"
"gorm.io/gorm/logger"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand All @@ -32,20 +31,15 @@ var groupResource = schema.GroupResource{
}

type Sqlite struct {
cfg *config.CLIConfig
db *gorm.DB
transformer value.Transformer
}

func NewSqlite(ctx context.Context) (Sqlite, error) {
// Passing the empty string here will first look for the config location in GPTSCRIPT_CONFIG_FILE.
// If that is not set, it will look at xdg.ConfigFile("gptscript/config.json"), the default location.
cfg, err := config.ReadCLIConfig("")
if err != nil {
return Sqlite{}, fmt.Errorf("error reading CLI config: %w", err)
}

var dbPath string
var (
dbPath string
err error
)
if os.Getenv("GPTSCRIPT_SQLITE_FILE") != "" {
dbPath = os.Getenv("GPTSCRIPT_SQLITE_FILE")
} else {
Expand All @@ -69,10 +63,7 @@ func NewSqlite(ctx context.Context) (Sqlite, error) {
return Sqlite{}, fmt.Errorf("failed to auto migrate GptscriptCredential: %w", err)
}

s := Sqlite{
cfg: cfg,
db: db,
}
s := Sqlite{db: db}

encryptionConf, err := readEncryptionConfig(ctx)
if err != nil {
Expand Down