Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting environment variable doesn't work to authenticate #65

Open
osrl opened this issue Oct 26, 2016 · 3 comments
Open

Setting environment variable doesn't work to authenticate #65

osrl opened this issue Oct 26, 2016 · 3 comments

Comments

@osrl
Copy link

osrl commented Oct 26, 2016

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
Copy link

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
Copy link

I tried the suggestion by @mishgunn but no luck for me... :-(

@hhongwen
Copy link

Has this problem been solved now? I had the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants