Skip to content

Commit

Permalink
don't use encrypted and trust options for secure schemas (#568)
Browse files Browse the repository at this point in the history
  • Loading branch information
nossila authored Jul 26, 2021
1 parent 8b2fe82 commit 81c912d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
3 changes: 3 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Version 4.0.5 2021-07-26
* Fix issue with secure schema

Version 4.0.4 2021-07-01
* Fix for docker tests (#479)
* Add support for slow query log (#480)
Expand Down
29 changes: 17 additions & 12 deletions neomodel/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,23 @@ def set_connection(self, url):
raise ValueError("Expecting url format: bolt://user:password@localhost:7687"
" got {0}".format(url))

self.driver = GraphDatabase.driver(u.scheme + '://' + hostname,
auth=basic_auth(username, password),
connection_acquisition_timeout=config.CONNECTION_ACQUISITION_TIMEOUT,
connection_timeout=config.CONNECTION_TIMEOUT,
encrypted=config.ENCRYPTED,
keep_alive=config.KEEP_ALIVE,
max_connection_lifetime=config.MAX_CONNECTION_LIFETIME,
max_connection_pool_size=config.MAX_CONNECTION_POOL_SIZE,
max_transaction_retry_time=config.MAX_TRANSACTION_RETRY_TIME,
resolver=config.RESOLVER,
trust=config.TRUST,
user_agent=config.USER_AGENT)
options = dict(
auth=basic_auth(username, password),
connection_acquisition_timeout=config.CONNECTION_ACQUISITION_TIMEOUT,
connection_timeout=config.CONNECTION_TIMEOUT,
keep_alive=config.KEEP_ALIVE,
max_connection_lifetime=config.MAX_CONNECTION_LIFETIME,
max_connection_pool_size=config.MAX_CONNECTION_POOL_SIZE,
max_transaction_retry_time=config.MAX_TRANSACTION_RETRY_TIME,
resolver=config.RESOLVER,
user_agent=config.USER_AGENT
)

if "+s" not in u.scheme:
options['encrypted'] = config.ENCRYPTED
options['trust'] = config.TRUST

self.driver = GraphDatabase.driver(u.scheme + '://' + hostname, **options)
self.url = url
self._pid = os.getpid()
self._active_transaction = None
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name='neomodel',
version='4.0.4',
version='4.0.5',
description='An object mapper for the neo4j graph database.',
long_description=open('README.rst').read(),
author='Robin Edwards',
Expand Down

0 comments on commit 81c912d

Please sign in to comment.