From 3792225878399df7ed83cab995f7544e69ac0f19 Mon Sep 17 00:00:00 2001 From: Romain LE JEUNE Date: Wed, 11 Jan 2023 11:14:56 +0100 Subject: [PATCH] feat(GODT-2229): Let bridge provides the subfolder for gluon's dirs. --- builder.go | 5 ++--- internal/backend/backend.go | 5 ++--- tests/server_test.go | 6 +++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/builder.go b/builder.go index 9251f9fb..8d412ebc 100644 --- a/builder.go +++ b/builder.go @@ -4,7 +4,6 @@ import ( "crypto/tls" "io" "os" - "path/filepath" "time" "github.com/ProtonMail/gluon/internal/backend" @@ -73,8 +72,8 @@ func (builder *serverBuilder) build() (*Server, error) { } backend, err := backend.New( - filepath.Join(builder.dataDir, "backend"), - filepath.Join(builder.databaseDir, "backend"), + builder.dataDir, + builder.databaseDir, builder.storeBuilder, builder.delim, builder.loginJailTime, diff --git a/internal/backend/backend.go b/internal/backend/backend.go index 5fe836b2..31afc767 100644 --- a/internal/backend/backend.go +++ b/internal/backend/backend.go @@ -3,7 +3,6 @@ package backend import ( "context" "fmt" - "path/filepath" "sync" "sync/atomic" "time" @@ -251,9 +250,9 @@ func (b *Backend) getUserID(ctx context.Context, username string, password []byt } func (b *Backend) getStoreDir() string { - return filepath.Join(b.dataDir, "store") + return b.dataDir } func (b *Backend) getDBDir() string { - return filepath.Join(b.databaseDir, "db") + return b.databaseDir } diff --git a/tests/server_test.go b/tests/server_test.go index a4ed30fb..fa5544a5 100644 --- a/tests/server_test.go +++ b/tests/server_test.go @@ -204,8 +204,8 @@ func defaultServerOptions(tb testing.TB, modifiers ...serverOption) *serverOptio }}, delimiter: "/", loginJailTime: time.Second, - dataDir: tb.TempDir(), - databaseDir: tb.TempDir(), + dataDir: filepath.Join(tb.TempDir(), "backend", "store"), + databaseDir: filepath.Join(tb.TempDir(), "backend", "db"), idleBulkTime: time.Duration(500 * time.Millisecond), storeBuilder: &store.OnDiskStoreBuilder{}, connectorBuilder: &dummyConnectorBuilder{}, @@ -302,7 +302,7 @@ func runServer(tb testing.TB, options *serverOptions, tests func(session *testSe } conns[userID] = conn - dbPaths[userID] = filepath.Join(server.GetDatabasePath(), "backend", "db", fmt.Sprintf("%v.db", userID)) + dbPaths[userID] = filepath.Join(server.GetDatabasePath(), fmt.Sprintf("%v.db", userID)) } listener, err := net.Listen("tcp", net.JoinHostPort("localhost", "0"))