File tree Expand file tree Collapse file tree 5 files changed +5
-7
lines changed Expand file tree Collapse file tree 5 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ LEGACY_AWS_S3_CUSTOM_DOMAIN=127.0.0.1:9090/service-stac-local
19
19
SECRET_KEY=dummy
20
20
HEALTHCHECK_ENDPOINT=healthcheck
21
21
ALLOWED_HOSTS=*
22
- MANAGED_BUCKET_COLLECTION_PATTERNS=ch\ .meteoschweiz\ .ogd-.* ,ch\ .bgdi-test\..*
22
+ MANAGED_BUCKET_COLLECTION_PATTERNS=ch.meteoschweiz.ogd-,ch.bgdi-test.
23
23
24
24
# these are just here for completeness
25
25
AWS_ROLE_ARN=some-arn
Original file line number Diff line number Diff line change @@ -535,7 +535,7 @@ The service is configured by Environment Variable:
535
535
| AWS_S3_ENDPOINT_URL | ` None` | |
536
536
| AWS_S3_CUSTOM_DOMAIN | ` None` | |
537
537
| 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 |
539
539
| EXTERNAL_URL_REACHABLE_TIMEOUT | ` 5` | How long the external asset URL validator should try to connect to given asset in seconds |
540
540
541
541
# ### **Development settings (only for local environment and DEV staging)**
Original file line number Diff line number Diff line change 54
54
55
55
# Regex patterns of collections that should go to the managed bucket
56
56
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-" ]
58
58
)
59
59
60
60
# Since it's impossible to recreate the service-account situation with minio
Original file line number Diff line number Diff line change 3
3
import json
4
4
import logging
5
5
import os
6
- import re
7
6
from base64 import b64decode
8
7
from datetime import datetime
9
8
from datetime import timezone
@@ -571,8 +570,7 @@ def select_s3_bucket(collection_name) -> AVAILABLE_S3_BUCKETS:
571
570
patterns = settings .MANAGED_BUCKET_COLLECTION_PATTERNS
572
571
573
572
for pattern in patterns :
574
- match = re .fullmatch (pattern , collection_name )
575
- if match is not None :
573
+ if collection_name .startswith (pattern ):
576
574
return AVAILABLE_S3_BUCKETS .managed
577
575
578
576
return AVAILABLE_S3_BUCKETS .legacy
Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ class TestBucketSelector(TestCase):
163
163
])
164
164
def test_bucket_selection (self , collection_name , expected_bucket ):
165
165
"""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. ' ]
167
167
with self .settings (MANAGED_BUCKET_COLLECTION_PATTERNS = patterns ):
168
168
bucket_name = select_s3_bucket (collection_name )
169
169
You can’t perform that action at this time.
0 commit comments