From 2d955db44b30f5e8057228499622acfd0e4f5a89 Mon Sep 17 00:00:00 2001
From: timotheyca <tim@ongoteam.yaconnect.com>
Date: Sat, 27 Nov 2021 18:31:01 +0300
Subject: [PATCH] host config

---
 v6d0auth/config.py       | 3 ++-
 v6d0auth/run-server.py   | 4 ++--
 v6d0auth/test-request.py | 5 +++--
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/v6d0auth/config.py b/v6d0auth/config.py
index c396dbc..55d892c 100644
--- a/v6d0auth/config.py
+++ b/v6d0auth/config.py
@@ -1,11 +1,12 @@
 import os
 from pathlib import Path
 
-__all__ = ('myroot', 'port', 'cakey')
+__all__ = ('myroot', 'host', 'port', 'cakey')
 
 _root = Path(os.getenv('v6root', './data'))
 assert _root.exists()
 myroot = _root / 'v6d0auth'
 myroot.mkdir(exist_ok=True)
+host = os.getenv('v6port', '127.0.0.1')
 port = int(os.getenv('v6port', '5003'))
 cakey = bytes.fromhex(os.getenv('v6ca', ''))
diff --git a/v6d0auth/run-server.py b/v6d0auth/run-server.py
index 66704fc..f4580cc 100644
--- a/v6d0auth/run-server.py
+++ b/v6d0auth/run-server.py
@@ -3,8 +3,8 @@ import asyncio
 from aiohttp import web
 
 from v6d0auth.app import get_app
-from v6d0auth.config import port
+from v6d0auth.config import port, host
 
 if __name__ == '__main__':
     loop = asyncio.get_event_loop()
-    web.run_app(get_app(loop), host='127.0.0.1', port=port, loop=loop)
+    web.run_app(get_app(loop), host=host, port=port, loop=loop)
diff --git a/v6d0auth/test-request.py b/v6d0auth/test-request.py
index 8e67e29..5f6aaac 100644
--- a/v6d0auth/test-request.py
+++ b/v6d0auth/test-request.py
@@ -1,11 +1,12 @@
 import asyncio
 
 from v6d0auth.client import request_signature
-from v6d0auth.config import port
+from v6d0auth.config import port, host
 
 
 async def main():
-    print((await request_signature(f'http://127.0.0.1:{port}')).hex())
+    # noinspection HttpUrlsUsage
+    print((await request_signature(f'http://{host}:{port}')).hex())
 
 
 if __name__ == '__main__':