fix default region reversion

Commit 215640096f caused the default
region for S3 to change to us-east-2. This was due to regionInfo having
an undocumented property that the first item in the list is for the
default region.

Avoid relying on regionInfo for defaultRegion.

Sponsored-by: Dartmouth College's DANDI project
This commit is contained in:
Joey Hess 2025-08-13 14:19:36 -04:00
commit fed5e00a18
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -1,6 +1,6 @@
{- Amazon Web Services common infrastructure.
-
- Copyright 2011-2014 Joey Hess <id@joeyh.name>
- Copyright 2011-2025 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
@ -40,7 +40,8 @@ regionMap :: Service -> M.Map Text Region
regionMap = M.fromList . regionInfo
defaultRegion :: Service -> Region
defaultRegion = snd . fromMaybe (error "internal") . headMaybe . regionInfo
defaultRegion S3 = "US"
defaultRegion Glacier = "us-east-1"
data ServiceRegion = BothRegion Region | S3Region Region | GlacierRegion Region