1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

unfinished work

This commit is contained in:
Steffo 2019-11-05 11:30:06 +01:00
parent 4b5fde06cb
commit c09631786f
3 changed files with 16 additions and 22 deletions

View file

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

View file

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

5
royalnet/web/star.py Normal file
View file

@ -0,0 +1,5 @@
import starlette
class Star:
...