Skip to content

Commit 81c912d

Browse files
authored
don't use encrypted and trust options for secure schemas (#568)
1 parent 8b2fe82 commit 81c912d

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

Changelog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Version 4.0.5 2021-07-26
2+
* Fix issue with secure schema
3+
14
Version 4.0.4 2021-07-01
25
* Fix for docker tests (#479)
36
* Add support for slow query log (#480)

neomodel/util.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,23 @@ def set_connection(self, url):
100100
raise ValueError("Expecting url format: bolt://user:password@localhost:7687"
101101
" got {0}".format(url))
102102

103-
self.driver = GraphDatabase.driver(u.scheme + '://' + hostname,
104-
auth=basic_auth(username, password),
105-
connection_acquisition_timeout=config.CONNECTION_ACQUISITION_TIMEOUT,
106-
connection_timeout=config.CONNECTION_TIMEOUT,
107-
encrypted=config.ENCRYPTED,
108-
keep_alive=config.KEEP_ALIVE,
109-
max_connection_lifetime=config.MAX_CONNECTION_LIFETIME,
110-
max_connection_pool_size=config.MAX_CONNECTION_POOL_SIZE,
111-
max_transaction_retry_time=config.MAX_TRANSACTION_RETRY_TIME,
112-
resolver=config.RESOLVER,
113-
trust=config.TRUST,
114-
user_agent=config.USER_AGENT)
103+
options = dict(
104+
auth=basic_auth(username, password),
105+
connection_acquisition_timeout=config.CONNECTION_ACQUISITION_TIMEOUT,
106+
connection_timeout=config.CONNECTION_TIMEOUT,
107+
keep_alive=config.KEEP_ALIVE,
108+
max_connection_lifetime=config.MAX_CONNECTION_LIFETIME,
109+
max_connection_pool_size=config.MAX_CONNECTION_POOL_SIZE,
110+
max_transaction_retry_time=config.MAX_TRANSACTION_RETRY_TIME,
111+
resolver=config.RESOLVER,
112+
user_agent=config.USER_AGENT
113+
)
114+
115+
if "+s" not in u.scheme:
116+
options['encrypted'] = config.ENCRYPTED
117+
options['trust'] = config.TRUST
118+
119+
self.driver = GraphDatabase.driver(u.scheme + '://' + hostname, **options)
115120
self.url = url
116121
self._pid = os.getpid()
117122
self._active_transaction = None

setup.py

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

55
setup(
66
name='neomodel',
7-
version='4.0.4',
7+
version='4.0.5',
88
description='An object mapper for the neo4j graph database.',
99
long_description=open('README.rst').read(),
1010
author='Robin Edwards',

0 commit comments

Comments
 (0)