host config

This commit is contained in:
AF 2021-11-27 18:31:01 +03:00
parent bda7e98b20
commit 2d955db44b
3 changed files with 7 additions and 5 deletions

View File

@ -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', ''))

View File

@ -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)

View File

@ -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__':