Skip to content
Snippets Groups Projects

Make blacklist api a configuration option

Merged Emre requested to merge configurable-blacklist-api into autoclave
All threads resolved!

This changeset makes the URL of the blacklist API a configuration option.

Example: (command line argument)

 $ hive server --blacklist-api-url http://foo.bar

Environment variable:

BLACKLIST_API_URL=http://foo.bar hive server

It's an optional argument. If it's not passed, the default value is : https://blacklist.usehive.com.

Edited by Emre

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Emre added 1 commit

    added 1 commit

    • 346aabf7 - Make blacklist api a configuration option

    Compare with previous version

  • Emre changed the description

    changed the description

  • Untested, but changes LGTM.

  • Emre resolved all threads

    resolved all threads

  • If I don't want to use a blacklist and pass empty string to the variable BLACKLIST_API_URL=, I get this error that freezes hivemind.

    I think the full URL should be passed like so BLACKLIST_API_URL=https://blacklist.usehive.com/blacklists

    Traceback (most recent call last):
      File "/usr/local/bin/hive", line 8, in <module>
        sys.exit(run())
      File "/usr/local/lib/python3.6/dist-packages/hive/cli.py", line 23, in run
        launch_mode(mode, conf)
      File "/usr/local/lib/python3.6/dist-packages/hive/cli.py", line 30, in launch_mode
        run_server(conf=conf)
      File "/usr/local/lib/python3.6/dist-packages/hive/server/serve.py", line 170, in run_server
        mutes = Mutes(conf.get('muted_accounts_url'), conf.get('blacklist_api_url'))
      File "/usr/local/lib/python3.6/dist-packages/hive/server/common/mutes.py", line 40, in __init__
        self.load()
      File "/usr/local/lib/python3.6/dist-packages/hive/server/common/mutes.py", line 45, in load
        jsn = _read_url(self.blacklist_api_url + "/blacklists")
      File "/usr/local/lib/python3.6/dist-packages/hive/server/common/mutes.py", line 11, in _read_url
        req = Request(url, headers={'User-Agent': 'Mozilla/5.0'})
      File "/usr/lib/python3.6/urllib/request.py", line 329, in __init__
        self.full_url = url
      File "/usr/lib/python3.6/urllib/request.py", line 355, in full_url
        self._parse()
      File "/usr/lib/python3.6/urllib/request.py", line 384, in _parse
        raise ValueError("unknown url type: %r" % self.full_url)
    ValueError: unknown url type: '/blacklists'
    Edited by Jolly Pirate
  • Author Developer

    Yes, this change doesn't make it optional. But, it makes it configurable. Passing empty string won't do the job, it needs the domain or nothing. (There is a default) In the error, since you pass the domain empty string, it tries to merge it with /blacklists endpoint and fails.

    It should be passed just as a domain:

    E.g: BLACKLIST_API_URL=https://blacklist.usehive.com

    Because there are two different calls using this domain with different paths. (/blacklist/ and /user/)

    Edited by Emre
  • At some point, the muted and blacklist should be optional.

  • merged

  • Gandalf mentioned in commit 0c851a07

    mentioned in commit 0c851a07

  • Please register or sign in to reply
    Loading