Skip to content

Commit dc0e67e

Browse files
authored
Merge pull request #3927 from hove-io/add_application_name_in_db_connexion
application_name added in connect_args
2 parents 088cb70 + 87ab556 commit dc0e67e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

source/jormungandr/jormungandr/default_settings.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
from flask_restful.inputs import boolean
77

88
# sql queries will return an exception if the query did not succeed before `statement_timeout`
9-
DEFAULT_SQLALCHEMY_ENGINE_OPTIONS = {"connect_args": {"options": "-c statement_timeout=1000"}} # 1000ms
9+
DEFAULT_SQLALCHEMY_ENGINE_OPTIONS = {
10+
"connect_args": {"options": "-c statement_timeout=1000", "application_name": "Jormungandr"}
11+
} # 1000ms
1012

1113
# path of the configuration file for each instances
1214
INSTANCES_DIR = os.getenv('JORMUNGANDR_INSTANCES_DIR', '/etc/jormungandr.d')

source/tyr/tyr/default_settings.py

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from datetime import timedelta
33
from celery import schedules
44
import os
5+
import json
56
from flask_restful.inputs import boolean
67

78
# URL for the brokker, by default it's the local rabbitmq
@@ -19,6 +20,11 @@
1920
'TYR_SQLALCHEMY_DATABASE_URI', 'postgresql://navitia:navitia@localhost/jormungandr'
2021
)
2122

23+
DEFAULT_SQLALCHEMY_ENGINE_OPTIONS = {"connect_args": {"application_name": "Tyr"}}
24+
25+
SQLALCHEMY_ENGINE_OPTIONS = (
26+
json.loads(os.getenv('TYR_SQLALCHEMY_ENGINE_OPTIONS', '{}')) or DEFAULT_SQLALCHEMY_ENGINE_OPTIONS
27+
)
2228

2329
# URI for cities database
2430
# postgresql://<user>:<password>@<host>:<port>/<dbname>

0 commit comments

Comments
 (0)