Skip to content

Commit

Permalink
Merge pull request #47 from geoadmin/develop
Browse files Browse the repository at this point in the history
New Release v1.3.0 - #minor
  • Loading branch information
ltshb authored Apr 4, 2022
2 parents 54b74a7 + c732afb commit 6bfccca
Show file tree
Hide file tree
Showing 7 changed files with 486 additions and 419 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name = "pypi"
PyYAML = ">=5.4"
gevent = "~=20.9.0"
gunicorn = "~=19.9.0"
Flask = "~=1.1.1"
Flask = "~=2.1.1"
logging-utilities = "~=1.2.1"
defusedxml = "~=0.7.1"
boto3 = "~=1.17.60"
Expand Down
885 changes: 474 additions & 411 deletions Pipfile.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from app.settings import CACHE_CONTROL_4XX

logger = logging.getLogger(__name__)
logger_routes = logging.getLogger('app.routes')

# Standard Flask application initialisation

Expand All @@ -29,7 +30,7 @@
@app.before_request
def log_route():
g.setdefault('request_started', time.time())
logger.info('%s %s', request.method, request.path)
logger_routes.debug('%s %s', request.method, request.path)


# Add CORS Headers to all request
Expand Down Expand Up @@ -79,7 +80,7 @@ def validate_origin():

@app.after_request
def log_response(response):
logger.info(
logger_routes.info(
"%s %s - %s",
request.method,
request.path,
Expand Down
2 changes: 1 addition & 1 deletion app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
KML_FILE_CACHE_CONTROL = os.getenv('KML_FILE_CACHE_CONTROL', NO_CACHE)

ALLOWED_DOMAINS = os.getenv('ALLOWED_DOMAINS', r'.*').split(',')
ALLOWED_DOMAINS_PATTERN = '({})'.format('|'.join(ALLOWED_DOMAINS))
ALLOWED_DOMAINS_PATTERN = f"({'|'.join(ALLOWED_DOMAINS)})"

SCRIPT_NAME = os.getenv('SCRIPT_NAME', '')

Expand Down
4 changes: 2 additions & 2 deletions tests/unit_tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# The mocking is placed here to make sure it is started earliest possible.
# see: https://github.com/spulec/moto#very-important----recommended-usage
from moto import mock_dynamodb2
from moto import mock_dynamodb
from moto import mock_s3

s3mock = mock_s3()
s3mock.start()
dynamodb = mock_dynamodb2()
dynamodb = mock_dynamodb()
dynamodb.start()
5 changes: 4 additions & 1 deletion tests/unit_tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ def create_dynamodb():
"ReadCapacityUnits": 1, "WriteCapacityUnits": 1
}
}
]
],
ProvisionedThroughput={
"ReadCapacityUnits": 1, "WriteCapacityUnits": 1
},
)
except dynamodb.meta.client.exceptions.ResourceInUseException as err:
logger.debug("Table %s already exists but should not.", AWS_DB_TABLE_NAME)
Expand Down
2 changes: 1 addition & 1 deletion wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def load(self):
HTTP_PORT = str(os.environ.get('HTTP_PORT', "5000"))
# Bind to 0.0.0.0 to let your app listen to all network interfaces.
options = {
'bind': '%s:%s' % ('0.0.0.0', HTTP_PORT),
'bind': f"0.0.0.0:{HTTP_PORT}",
'worker_class': 'gevent',
'workers': 2, # scaling horizontally is left to Kubernetes
'timeout': 60,
Expand Down

0 comments on commit 6bfccca

Please sign in to comment.