Skip to content
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
1 change: 1 addition & 0 deletions dvc/config_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ class RelPath(str):
"grant_read_acp": str,
"grant_write_acp": str,
"grant_full_control": str,
"cache_regions": bool,
Comment thread
isidentical marked this conversation as resolved.
**REMOTE_COMMON,
},
"gs": {
Expand Down
12 changes: 10 additions & 2 deletions dvc/fs/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ def _load_aws_config_file(self, profile):
self._transfer_config = None
config_path = os.environ.get("AWS_CONFIG_FILE", _AWS_CONFIG_PATH)
if not os.path.exists(config_path):
return None
return {}

config = load_config(config_path)
profile_config = config["profiles"].get(profile or "default")
if not profile_config:
return None
return {}

s3_config = profile_config.get("s3", {})
return self._split_s3_config(s3_config)
Expand Down Expand Up @@ -123,6 +123,14 @@ def _prepare_credentials(self, **config):
if shared_creds:
os.environ.setdefault("AWS_SHARED_CREDENTIALS_FILE", shared_creds)

if (
client["region_name"] is None
and session_config["s3"].get("region_name") is None
and os.getenv("AWS_REGION") is None
):
# Enable bucket region caching
login_info["cache_regions"] = config.get("cache_regions", True)

config_path = config.get("configpath")
if config_path:
os.environ.setdefault("AWS_CONFIG_FILE", config_path)
Expand Down