Skip to content

Commit d395faf

Browse files
authored
Merge pull request #599 from geoadmin/develop
New Release v2.1.0 - #minor
2 parents 56821fe + f4fc1e4 commit d395faf

File tree

5 files changed

+5
-7
lines changed

5 files changed

+5
-7
lines changed

.env.default

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ LEGACY_AWS_S3_CUSTOM_DOMAIN=127.0.0.1:9090/service-stac-local
1919
SECRET_KEY=dummy
2020
HEALTHCHECK_ENDPOINT=healthcheck
2121
ALLOWED_HOSTS=*
22-
MANAGED_BUCKET_COLLECTION_PATTERNS=ch\.meteoschweiz\.ogd-.*,ch\.bgdi-test\..*
22+
MANAGED_BUCKET_COLLECTION_PATTERNS=ch.meteoschweiz.ogd-,ch.bgdi-test.
2323

2424
# these are just here for completeness
2525
AWS_ROLE_ARN=some-arn

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ The service is configured by Environment Variable:
535535
| AWS_S3_ENDPOINT_URL | `None` | |
536536
| AWS_S3_CUSTOM_DOMAIN | `None` | |
537537
| AWS_PRESIGNED_URL_EXPIRES | 3600 | AWS presigned url for asset upload expire time in seconds |
538-
| MANAGED_BUCKET_COLLECTION_PATTERNS | - | A list of regex patterns for collections that go to the managed bucket |
538+
| MANAGED_BUCKET_COLLECTION_PATTERNS | - | A list of prefix patterns for collections that go to the managed bucket |
539539
| EXTERNAL_URL_REACHABLE_TIMEOUT | `5` | How long the external asset URL validator should try to connect to given asset in seconds |
540540

541541
#### **Development settings (only for local environment and DEV staging)**

app/config/settings_dev.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
# Regex patterns of collections that should go to the managed bucket
5656
MANAGED_BUCKET_COLLECTION_PATTERNS = env.list(
57-
'MANAGED_BUCKET_COLLECTION_PATTERNS', default=[r"^ch\.meteoschweiz\.ogd-*"]
57+
'MANAGED_BUCKET_COLLECTION_PATTERNS', default=["ch.meteoschweiz.ogd-"]
5858
)
5959

6060
# Since it's impossible to recreate the service-account situation with minio

app/stac_api/utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import json
44
import logging
55
import os
6-
import re
76
from base64 import b64decode
87
from datetime import datetime
98
from datetime import timezone
@@ -571,8 +570,7 @@ def select_s3_bucket(collection_name) -> AVAILABLE_S3_BUCKETS:
571570
patterns = settings.MANAGED_BUCKET_COLLECTION_PATTERNS
572571

573572
for pattern in patterns:
574-
match = re.fullmatch(pattern, collection_name)
575-
if match is not None:
573+
if collection_name.startswith(pattern):
576574
return AVAILABLE_S3_BUCKETS.managed
577575

578576
return AVAILABLE_S3_BUCKETS.legacy

app/tests/test_multiple_bucket_setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class TestBucketSelector(TestCase):
163163
])
164164
def test_bucket_selection(self, collection_name, expected_bucket):
165165
"""Test if the pattern selection works"""
166-
patterns = [r'ch\.meteoschweiz\.ogd-.*', r'ch\.swisstopo\.bgdi.*', r'ch\.are\..*']
166+
patterns = ['ch.meteoschweiz.ogd-', 'ch.swisstopo.bgdi', 'ch.are.']
167167
with self.settings(MANAGED_BUCKET_COLLECTION_PATTERNS=patterns):
168168
bucket_name = select_s3_bucket(collection_name)
169169

0 commit comments

Comments
 (0)