diff --git a/royalnet/__main__.py b/royalnet/__main__.py index 22cf9ca3..1315d42b 100644 --- a/royalnet/__main__.py +++ b/royalnet/__main__.py @@ -5,13 +5,16 @@ import royalnet as r import royalherald as rh import multiprocessing import keyring +import starlette @click.command() @click.option("--telegram/--no-telegram", default=None, - help="Enable/disable the Telegram module.") + help="Enable/disable the Telegram bot.") @click.option("--discord/--no-discord", default=None, - help="Enable/disable the Discord module.") + help="Enable/disable the Discord bot.") +@click.option("--webserver/--no-webserver", default=None, + help="Enable/disable the Web server.") @click.option("-d", "--database", type=str, default=None, help="The PostgreSQL database path.") @click.option("-p", "--packs", type=str, multiple=True, default=[], @@ -26,6 +29,7 @@ import keyring help="Print all possible debug information.") def run(telegram: typing.Optional[bool], discord: typing.Optional[bool], + webserver: typing.Optional[bool], database: typing.Optional[str], packs: typing.Tuple[str], network_address: typing.Optional[str], @@ -42,7 +46,8 @@ def run(telegram: typing.Optional[bool], # Enable / Disable interfaces interfaces = { "telegram": telegram, - "discord": discord + "discord": discord, + "webserver": webserver } # If any interface is True, then the undefined ones should be False if any(interfaces[name] is True for name in interfaces): @@ -129,6 +134,9 @@ def run(telegram: typing.Optional[bool], daemon=True) discord_process.start() + if interfaces["webserver"]: + ... + click.echo("Royalnet processes have been started. You can force-quit by pressing Ctrl+C.") if server_process is not None: server_process.join() diff --git a/royalnet/royalgamesweb.py b/royalnet/royalgamesweb.py deleted file mode 100644 index 01688154..00000000 --- a/royalnet/royalgamesweb.py +++ /dev/null @@ -1,19 +0,0 @@ -"""The production Royalnet available at ryg.steffo.eu .""" - -import os -from royalnet.web import create_app -from royalnet.web.royalprints import * - - -class TestConfig: - DB_PATH = os.environ["DB_PATH"] - TG_AK = os.environ["TG_AK"] - SITE_NAME = "Royalnet" - - -app = create_app(TestConfig, [rp_home, rp_wikiview, rp_tglogin, rp_docs, rp_wikiedit, rp_mcstatus, rp_diarioview, - rp_profile, rp_login]) - - -if __name__ == "__main__": - app.run() diff --git a/royalnet/web/star.py b/royalnet/web/star.py new file mode 100644 index 00000000..62cf8e6e --- /dev/null +++ b/royalnet/web/star.py @@ -0,0 +1,5 @@ +import starlette + + +class Star: + ...