Example #1
0
def app_main(description, create_app):
    args = _parse_args(description)

    loop = asyncio.get_event_loop()

    secrets = {"TELEGRAM_TOKEN": os.environ["TELEGRAM_TOKEN"]}
    try:
        config = Config.from_file("config.json")
    except Exception:
        config = Config.from_json({"CHAT_ID": os.environ["CHAT_ID"]})

    app = create_app(loop=loop, secrets=secrets, config=config)
    web.run_app(app, host=args.host, port=args.port)
Example #2
0
def test_creating_from_file():
    config = Config.from_file(TEST_DATA_DIR / "test_config.json")
    assert getattr(config, "CHAT_ID") == 111111111