Skip to content

Commit edaa0f7

Browse files
authored
Make all fields of the credentials file optional (#51)
Specifying a credentials file, even if empty, should be sufficient to ensure a successful connection. In the case where host or port are missing, the credentials file will contribute the default `localhost:5656`. It is no longer an error to specify a credentials file with a missing user.
1 parent 7be9418 commit edaa0f7

File tree

3 files changed

+39
-28
lines changed

3 files changed

+39
-28
lines changed

connection_testcases.json

+27-14
Original file line numberDiff line numberDiff line change
@@ -2557,6 +2557,33 @@
25572557
"waitUntilAvailable": "PT30S"
25582558
}
25592559
},
2560+
{
2561+
"fs": {
2562+
"files": {
2563+
"/home/edgedb/test/credentials.json": "{}"
2564+
}
2565+
},
2566+
"name": "credentials_file_test_empty_credentials_file",
2567+
"opts": {
2568+
"credentialsFile": "/home/edgedb/test/credentials.json"
2569+
},
2570+
"result": {
2571+
"address": [
2572+
"localhost",
2573+
5656
2574+
],
2575+
"branch": "__default__",
2576+
"database": "edgedb",
2577+
"password": null,
2578+
"secretKey": null,
2579+
"serverSettings": {},
2580+
"tlsCAData": null,
2581+
"tlsSecurity": "strict",
2582+
"tlsServerName": null,
2583+
"user": "edgedb",
2584+
"waitUntilAvailable": "PT30S"
2585+
}
2586+
},
25602587
{
25612588
"env": {
25622589
"EDGEDB_PORT": "1234"
@@ -3623,20 +3650,6 @@
36233650
"dsn": "edgedb://testuser@localhost/db?secret_key_file=/home/edgedb/secret_key"
36243651
}
36253652
},
3626-
{
3627-
"error": {
3628-
"type": "invalid_credentials_file"
3629-
},
3630-
"fs": {
3631-
"files": {
3632-
"/home/edgedb/test/credentials.json": "{\"port\": 10702, \"password\": \"lZTBy1RVCfOpBAOwSCwIyBIR\", \"database\": \"test3n\"}"
3633-
}
3634-
},
3635-
"name": "error_invalid_credentials_file_test_0",
3636-
"opts": {
3637-
"credentialsFile": "/home/edgedb/test/credentials.json"
3638-
}
3639-
},
36403653
{
36413654
"error": {
36423655
"type": "invalid_credentials_file"

tests/credentials/file.jsonc

+12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
[
2+
{
3+
"fs": {
4+
"files": {
5+
"/home/edgedb/test/credentials.json": "{}"
6+
}
7+
},
8+
"name": "test_empty_credentials_file",
9+
"opts": {
10+
"credentialsFile": "/home/edgedb/test/credentials.json"
11+
},
12+
"result": {}
13+
},
214
{
315
"fs": {
416
"files": {

tests/error/invalid_credentials_file.jsonc

-14
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
11
[
2-
{
3-
"error": {
4-
"type": "invalid_credentials_file"
5-
},
6-
"fs": {
7-
"files": {
8-
"/home/edgedb/test/credentials.json": "{\"port\": 10702, \"password\": \"lZTBy1RVCfOpBAOwSCwIyBIR\", \"database\": \"test3n\"}"
9-
}
10-
},
11-
"name": "test_0",
12-
"opts": {
13-
"credentialsFile": "/home/edgedb/test/credentials.json"
14-
}
15-
},
162
{
173
"error": {
184
"type": "invalid_credentials_file"

0 commit comments

Comments
 (0)