Skip to content

Commit 81c4ca7

Browse files
committed
Fix an issue when EDGEDB_CLOUD_PROFILE is ignored.
If the `EDGEDB_CLOUD_PROFILE` is set, it should be visible at any point in the configuration resolution process.
1 parent d292a72 commit 81c4ca7

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

edgedb/con_utils.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,11 @@ def _parse_connect_dsn_and_args(
565565
else:
566566
instance_name, dsn = dsn, None
567567

568+
# The cloud profile is potentially relevant to resolving credentials at
569+
# any stage, including the config stage when other environment variables
570+
# are not yet read.
571+
cloud_profile = os.getenv('EDGEDB_CLOUD_PROFILE')
572+
568573
has_compound_options = _resolve_config_options(
569574
resolved_config,
570575
'Cannot have more than one of the following connection options: '
@@ -621,6 +626,11 @@ def _parse_connect_dsn_and_args(
621626
(wait_until_available, '"wait_until_available" option')
622627
if wait_until_available is not None else None
623628
),
629+
cloud_profile=(
630+
(cloud_profile,
631+
'"EDGEDB_CLOUD_PROFILE" environment variable')
632+
if cloud_profile is not None else None
633+
),
624634
)
625635

626636
if has_compound_options is False:
@@ -647,7 +657,6 @@ def _parse_connect_dsn_and_args(
647657
env_tls_ca_file = os.getenv('EDGEDB_TLS_CA_FILE')
648658
env_tls_security = os.getenv('EDGEDB_CLIENT_TLS_SECURITY')
649659
env_wait_until_available = os.getenv('EDGEDB_WAIT_UNTIL_AVAILABLE')
650-
cloud_profile = os.getenv('EDGEDB_CLOUD_PROFILE')
651660

652661
has_compound_options = _resolve_config_options(
653662
resolved_config,
@@ -714,11 +723,6 @@ def _parse_connect_dsn_and_args(
714723
'"EDGEDB_WAIT_UNTIL_AVAILABLE" environment variable'
715724
) if env_wait_until_available is not None else None
716725
),
717-
cloud_profile=(
718-
(cloud_profile,
719-
'"EDGEDB_CLOUD_PROFILE" environment variable')
720-
if cloud_profile is not None else None
721-
),
722726
)
723727

724728
if not has_compound_options:

0 commit comments

Comments
 (0)