Setting environment variable doesn't work to authenticate
osrl opened this issue · 3 comments
osrl commented
I've run the command:
mongo-connector -m localhost:27017 -t http://localhost:7474/db/data -d neo4j_doc_manager
Here is the log:
No handlers could be found for logger "mongo_connector.util"
Traceback (most recent call last):
File "/usr/local/bin/mongo-connector", line 9, in <module>
load_entry_point('neo4j-doc-manager==1.0.0.dev11', 'console_scripts', 'mongo-connector')()
File "/Library/Python/2.7/site-packages/mongo_connector/util.py", line 90, in wrapped
func(*args, **kwargs)
File "/Library/Python/2.7/site-packages/mongo_connector/connector.py", line 1059, in main
conf.parse_args()
File "/Library/Python/2.7/site-packages/mongo_connector/config.py", line 118, in parse_args
option, dict((k, values.get(k)) for k in option.cli_names))
File "/Library/Python/2.7/site-packages/mongo_connector/connector.py", line 854, in apply_doc_managers
dm_instances.append(DocManager(target_url, **kwargs))
File "/Library/Python/2.7/site-packages/mongo_connector/doc_managers/neo4j_doc_manager.py", line 38, in __init__
self.graph = Graph(url)
File "/Library/Python/2.7/site-packages/py2neo/database/__init__.py", line 327, in __new__
use_bolt = version_tuple(inst.__remote__.get().content["neo4j_version"]) >= (3,)
File "/Library/Python/2.7/site-packages/py2neo/database/http.py", line 157, in get
raise Unauthorized(self.uri.string)
py2neo.database.status.Unauthorized: http://localhost:7474/db/data/
I've set the NEO4J_AUTH env variable. I can read it.
~> env | grep NEO4J
NEO4J_AUTH=neo4j:neo4j
I couldn't see py2neo's authenticate(url, usr, pass)
method call in the source code. Or anything about NEO4J_AUTH variable. Is there something I've missed?
mishgunn commented
Dealt with the same issue. Had to put the following in the neo4j_doc_manager.py
https://github.com/neo4j-contrib/neo4j_doc_manager/blob/master/mongo_connector/doc_managers/neo4j_doc_manager.py#L40
auth = os.environ.get('NEO4J_AUTH')
if auth:
auths = auth.split(':')
authenticate(url.strip('http://'), auths[0], auths[1])
self.graph = Graph(url)
trickidicki commented
I tried the suggestion by @mishgunn but no luck for me... :-(
hhongwen commented
Has this problem been solved now? I had the same problem.