Merge pull request #41 from txgio/bind-address

Allowing to bind on other IP Addresses through an environment variable
This commit is contained in:
Alex Yatskov 2017-08-28 14:08:40 -07:00 committed by GitHub
commit daf5c96c0a
2 changed files with 4 additions and 1 deletions

View File

@ -21,6 +21,7 @@ import base64
import hashlib
import inspect
import json
import os
import os.path
import re
import select
@ -38,7 +39,7 @@ API_VERSION = 4
TICK_INTERVAL = 25
URL_TIMEOUT = 10
URL_UPGRADE = 'https://raw.githubusercontent.com/FooSoft/anki-connect/master/AnkiConnect.py'
NET_ADDRESS = '127.0.0.1'
NET_ADDRESS = os.getenv('ANKICONNECT_BIND_ADDRESS', '127.0.0.1')
NET_BACKLOG = 5
NET_PORT = 8765

View File

@ -45,6 +45,8 @@ AnkiConnect exposes Anki features to external applications via an easy to use
initialize a minimal HTTP sever running on port 8765 every time Anki executes. Other applications (including browser
extensions) can then communicate with it via HTTP POST requests.
By default, AnkiConnect will only bind the HTTP server to the `127.0.0.1.` IP Address, so you will only be able to access it from the same host on which it is running. If you need to access it over a network, you can set the environment variable `ANKICONNECT_BIND_ADDRESS` to change the binding address. For example, you can set it to `0.0.0.0` to bind it to all network interfaces on your host.
### Sample Invocation ###
Every request consists of a JSON-encoded object containing an *action*, and a set of contextual *parameters*. A simple