host config
This commit is contained in:
		
							parent
							
								
									bda7e98b20
								
							
						
					
					
						commit
						2d955db44b
					
				@ -1,11 +1,12 @@
 | 
				
			|||||||
import os
 | 
					import os
 | 
				
			||||||
from pathlib import Path
 | 
					from pathlib import Path
 | 
				
			||||||
 | 
					
 | 
				
			||||||
__all__ = ('myroot', 'port', 'cakey')
 | 
					__all__ = ('myroot', 'host', 'port', 'cakey')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
_root = Path(os.getenv('v6root', './data'))
 | 
					_root = Path(os.getenv('v6root', './data'))
 | 
				
			||||||
assert _root.exists()
 | 
					assert _root.exists()
 | 
				
			||||||
myroot = _root / 'v6d0auth'
 | 
					myroot = _root / 'v6d0auth'
 | 
				
			||||||
myroot.mkdir(exist_ok=True)
 | 
					myroot.mkdir(exist_ok=True)
 | 
				
			||||||
 | 
					host = os.getenv('v6port', '127.0.0.1')
 | 
				
			||||||
port = int(os.getenv('v6port', '5003'))
 | 
					port = int(os.getenv('v6port', '5003'))
 | 
				
			||||||
cakey = bytes.fromhex(os.getenv('v6ca', ''))
 | 
					cakey = bytes.fromhex(os.getenv('v6ca', ''))
 | 
				
			||||||
 | 
				
			|||||||
@ -3,8 +3,8 @@ import asyncio
 | 
				
			|||||||
from aiohttp import web
 | 
					from aiohttp import web
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from v6d0auth.app import get_app
 | 
					from v6d0auth.app import get_app
 | 
				
			||||||
from v6d0auth.config import port
 | 
					from v6d0auth.config import port, host
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if __name__ == '__main__':
 | 
					if __name__ == '__main__':
 | 
				
			||||||
    loop = asyncio.get_event_loop()
 | 
					    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)
 | 
				
			||||||
 | 
				
			|||||||
@ -1,11 +1,12 @@
 | 
				
			|||||||
import asyncio
 | 
					import asyncio
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from v6d0auth.client import request_signature
 | 
					from v6d0auth.client import request_signature
 | 
				
			||||||
from v6d0auth.config import port
 | 
					from v6d0auth.config import port, host
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async def main():
 | 
					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__':
 | 
					if __name__ == '__main__':
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user