Skip to content

Commit 02261a3

Browse files
committed
Added additional config param
1 parent a32f52b commit 02261a3

5 files changed

Lines changed: 15 additions & 13 deletions

File tree

server/auth/database.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -191,19 +191,17 @@ func dbInitDefault() {
191191

192192
// dbInitCreateAuthDirectory creates the directory structure pointed to by the auth file if it does not already exist.
193193
func dbInitCreateAuthDirectory(authFileName string) error {
194-
fullAuthFileName, err := fileSystem.Abs(authFileName)
194+
dir, _ := filepath.Split(authFileName)
195+
// If there's no directory, then we have nothing to create
196+
if len(dir) == 0 {
197+
return nil
198+
}
199+
fullDir, err := fileSystem.Abs(dir)
195200
if err != nil {
196201
return err
197202
}
198-
fullAuthDir := filepath.Dir(fullAuthFileName)
199-
if _, err := fileSystem.ReadFile(fullAuthDir); err != nil {
200-
if os.IsNotExist(err) {
201-
if err = fileSystem.MkDirs(fullAuthDir); err != nil {
202-
return err
203-
}
204-
} else {
205-
return err
206-
}
203+
if exists, _ := fileSystem.Exists(fullDir); !exists {
204+
return fileSystem.MkDirs(fullDir)
207205
}
208206
return nil
209207
}

servercfg/testdata/minver_validation.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ RemotesapiConfig *servercfg.DoltgresRemotesapiConfig 0.7.4 remotesapi,omitempty
3636
-Port *int 0.7.4 port,omitempty
3737
-ReadOnly *bool 0.7.4 read_only,omitempty
3838
PrivilegeFile *string 0.7.4 privilege_file,omitempty
39+
AuthFile *string 0.54.4 auth_file,omitempty
3940
BranchControlFile *string 0.7.4 branch_control_file,omitempty
4041
Vars []servercfg.DoltgresUserSessionVars 0.7.4 user_session_vars,omitempty
4142
-Name string 0.0.0 name

testing/dataloader/csvdataloader_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@ import (
2929
"github.com/dolthub/doltgresql/core/dataloader"
3030
"github.com/dolthub/doltgresql/server/initialization"
3131
"github.com/dolthub/doltgresql/server/types"
32+
doltgresservercfg "github.com/dolthub/doltgresql/servercfg"
3233
)
3334

3435
// TestCsvDataLoader tests the CsvDataLoader implementation.
3536
func TestCsvDataLoader(t *testing.T) {
3637
db := memory.NewDatabase("mydb")
3738
provider := memory.NewDBProvider(db)
38-
initialization.Initialize(nil)
39+
initialization.Initialize(nil, doltgresservercfg.DefaultServerConfig())
3940

4041
ctx := &sql.Context{
4142
Context: context.Background(),

testing/dataloader/tabdataloader_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ import (
2828
"github.com/dolthub/doltgresql/core/dataloader"
2929
"github.com/dolthub/doltgresql/server/initialization"
3030
"github.com/dolthub/doltgresql/server/types"
31+
doltgresservercfg "github.com/dolthub/doltgresql/servercfg"
3132
)
3233

3334
func TestTabDataLoader(t *testing.T) {
3435
db := memory.NewDatabase("mydb")
3536
provider := memory.NewDBProvider(db)
36-
initialization.Initialize(nil)
37+
initialization.Initialize(nil, doltgresservercfg.DefaultServerConfig())
3738

3839
ctx := &sql.Context{
3940
Context: context.Background(),

testing/generation/function_coverage/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222

2323
"github.com/dolthub/doltgresql/server/functions/framework"
2424
"github.com/dolthub/doltgresql/server/initialization"
25+
doltgresservercfg "github.com/dolthub/doltgresql/servercfg"
2526
"github.com/dolthub/doltgresql/testing/generation/utils"
2627
)
2728

@@ -33,7 +34,7 @@ type Assertion struct {
3334
}
3435

3536
func main() {
36-
initialization.Initialize(nil)
37+
initialization.Initialize(nil, doltgresservercfg.DefaultServerConfig())
3738
rootFolder, err := utils.GetRootFolder()
3839
if err != nil {
3940
fmt.Printf("%s\n", err.Error())

0 commit comments

Comments
 (0)