Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement database config in project dir #442

Merged
merged 1 commit into from
Jun 16, 2023
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
6 changes: 6 additions & 0 deletions edgedb/con_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,12 @@ def _parse_connect_dsn_and_args(
f'project defined cloud profile ("{cloud_profile}")'
),
)

opt_database_file = os.path.join(stash_dir, 'database')
if os.path.exists(opt_database_file):
with open(opt_database_file, 'rt') as f:
database = f.read().strip()
resolved_config.set_database(database, "project")
else:
raise errors.ClientConnectionError(
f'Found `edgedb.toml` but the project is not initialized. '
Expand Down
2 changes: 1 addition & 1 deletion tests/shared-client-testcases
4 changes: 4 additions & 0 deletions tests/test_con_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@


class TestConUtils(unittest.TestCase):
maxDiff = 1000

error_mapping = {
'credentials_file_not_found': (
Expand Down Expand Up @@ -184,6 +185,9 @@ def run_testcase(self, testcase):
if 'cloud-profile' in v:
profile = os.path.join(dir, 'cloud-profile')
files[profile] = v['cloud-profile']
if 'database' in v:
database_file = os.path.join(dir, 'database')
files[database_file] = v['database']
del files[f]

es.enter_context(
Expand Down