Skip to content

Commit

Permalink
feat(GODT-2229): Let bridge provides the subfolder for gluon's dirs. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rlejeune74 authored Jan 11, 2023
1 parent 41d6371 commit ace4819
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
5 changes: 2 additions & 3 deletions builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"crypto/tls"
"io"
"os"
"path/filepath"
"time"

"github.com/ProtonMail/gluon/internal/backend"
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 2 additions & 3 deletions internal/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package backend
import (
"context"
"fmt"
"path/filepath"
"sync"
"sync/atomic"
"time"
Expand Down Expand Up @@ -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
}
6 changes: 3 additions & 3 deletions tests/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
Expand Down Expand Up @@ -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"))
Expand Down

0 comments on commit ace4819

Please sign in to comment.