2018-12-12 18:54:38 +01:00
|
|
|
import logging
|
|
|
|
import traceback
|
|
|
|
import argparse
|
2019-12-31 22:33:08 +01:00
|
|
|
from lbry.wallet.server.env import Env
|
|
|
|
from lbry.wallet.server.server import Server
|
2018-12-12 18:54:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
def get_argument_parser():
|
|
|
|
parser = argparse.ArgumentParser(
|
2021-03-24 21:07:17 +01:00
|
|
|
prog="lbry-hub"
|
2018-12-12 18:54:38 +01:00
|
|
|
)
|
2021-10-20 00:16:36 +02:00
|
|
|
Env.contribute_to_arg_parser(parser)
|
|
|
|
return parser
|
2018-12-12 18:54:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
parser = get_argument_parser()
|
|
|
|
args = parser.parse_args()
|
2021-04-28 22:46:24 +02:00
|
|
|
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)-4s %(name)s:%(lineno)d: %(message)s")
|
2019-12-31 22:33:08 +01:00
|
|
|
logging.info('lbry.server starting')
|
2021-03-29 19:16:49 +02:00
|
|
|
logging.getLogger('aiohttp').setLevel(logging.WARNING)
|
|
|
|
logging.getLogger('elasticsearch').setLevel(logging.WARNING)
|
2018-12-12 18:54:38 +01:00
|
|
|
try:
|
2021-10-20 00:16:36 +02:00
|
|
|
server = Server(Env.from_arg_parser(args))
|
2018-12-12 18:54:38 +01:00
|
|
|
server.run()
|
|
|
|
except Exception:
|
|
|
|
traceback.print_exc()
|
2019-12-31 22:33:08 +01:00
|
|
|
logging.critical('lbry.server terminated abnormally')
|
2018-12-12 18:54:38 +01:00
|
|
|
else:
|
2019-12-31 22:33:08 +01:00
|
|
|
logging.info('lbry.server terminated normally')
|
2018-12-12 18:54:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|