From 16bdd3c22c10fc545728bb7f181fada2853cc399 Mon Sep 17 00:00:00 2001 From: marcsello Date: Thu, 14 May 2020 22:26:14 +0200 Subject: [PATCH] Updated documentation --- README.rst | 7 ++++--- app.py | 4 ++-- docs/config.rst | 29 ++++++++++++++++------------- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/README.rst b/README.rst index 55ce536..670100b 100644 --- a/README.rst +++ b/README.rst @@ -55,9 +55,10 @@ Called URL:: Body:: - { - "uuid" : "str: LOCAL_UUID" - } + { + "uuid" : "str: LOCAL_UUID", + "ip" : "str: optional: IP override" + } IP update diff --git a/app.py b/app.py index aef71e6..8ee479c 100644 --- a/app.py +++ b/app.py @@ -50,9 +50,9 @@ def main(): logging.basicConfig(filename='', level=logging.DEBUG) redis_storage = RedisSuperStorage(os.environ.get('REDIS_URL', "redis://localhost:6379/0"), - os.environ.get("CUSTOMER_TIMEOUT", 30)) + int(os.environ.get("CUSTOMER_TIMEOUT", 30))) - consumer_communicator = ConsumerCommunicator(redis_storage) + consumer_communicator = ConsumerCommunicator(redis_storage, bool(os.environ.get('FORCE_IP_OVERRIDE', False))) producer_communicator = ProducerCommunicator(redis_storage) ip_watchdog = IPWatchdog(redis_storage) diff --git a/docs/config.rst b/docs/config.rst index be44f99..595ac64 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -4,16 +4,19 @@ Configuration This software component can be configured via environmental variables, which are very useful in a containerized environment. -+--------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Variable | Default | Description | -+====================+==========================+=====================================================================================================================================================================+ -| `LOCAL_UUID` | **N/A** | The UUID of the consumer system. Must be the same as the API's | -+--------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `RUN_INTERVAL` | 10 | Interval between synchronizations, and local ip checks. | -+--------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `CUSTOMER_TIMEOUT` | 30 | Default timeout to be set for a consumer. If the timeout expires, the consumer will be considered invalid, and no further attempts will be made to contact with it. | -+--------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `REDIS_URL` | redis://localhost:6379/0 | URL of the Redis database shared with the consumer api | -+--------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `INITIAL_SERVERS` | **N/A** | A comma separated list of the initially known consumers (Can be empty, but must be specified) | -+--------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ \ No newline at end of file + ++---------------------+--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Variable | Default | Description | ++=====================+==========================+====================================================================================================================================================================================================+ +| `LOCAL_UUID` | **N/A** | The UUID of the consumer system. Must be the same as the API's | ++---------------------+--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `RUN_INTERVAL` | 10 | Interval between synchronizations, and local ip checks. | ++---------------------+--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `CUSTOMER_TIMEOUT` | 30 | Default timeout to be set for a consumer. If the timeout expires, the consumer will be considered invalid, and no further attempts will be made to contact with it. | ++---------------------+--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `REDIS_URL` | redis://localhost:6379/0 | URL of the Redis database shared with the consumer api | ++---------------------+--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `INITIAL_SERVERS` | **N/A** | A comma separated list of the initially known consumers (Can be empty, but must be specified) | ++---------------------+--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `FORCE_IP_OVERRIDE` | False | Include the ip address of the consumer into the sync message, causing the other consumer to save this ip address instead of the one it recieved the request from (Useful for weird netowrk setups) | ++---------------------+--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ \ No newline at end of file