2018-06-12 21:45:50 +02:00
|
|
|
|
2018-07-13 16:02:30 +02:00
|
|
|
from typing import Any, Dict, Iterable, Union
|
2018-07-11 22:06:06 +02:00
|
|
|
|
2018-06-12 21:45:50 +02:00
|
|
|
import sys
|
|
|
|
|
2018-09-15 02:12:16 +02:00
|
|
|
from matemat.webserver import MatematWebserver
|
2018-07-13 00:14:48 +02:00
|
|
|
from matemat.webserver import parse_config_file
|
2018-07-11 22:06:06 +02:00
|
|
|
|
2018-09-15 02:12:16 +02:00
|
|
|
# Those imports are actually needed, as they implicitly register pagelets.
|
|
|
|
# noinspection PyUnresolvedReferences
|
|
|
|
from matemat.webserver.pagelets import *
|
|
|
|
|
2018-06-12 21:45:50 +02:00
|
|
|
|
2018-09-15 02:12:16 +02:00
|
|
|
def main():
|
2018-07-11 22:06:06 +02:00
|
|
|
# Use config file name from command line, if present
|
2018-07-13 16:02:30 +02:00
|
|
|
configfile: Union[str, Iterable[str]] = '/etc/matemat.conf'
|
2018-06-12 21:45:50 +02:00
|
|
|
if len(sys.argv) > 1:
|
2018-07-13 16:02:30 +02:00
|
|
|
configfile = sys.argv[1:]
|
2018-07-11 22:06:06 +02:00
|
|
|
|
|
|
|
# Parse the config file
|
|
|
|
config: Dict[str, Any] = parse_config_file(configfile)
|
2018-06-12 21:45:50 +02:00
|
|
|
|
|
|
|
# Start the web server
|
2018-07-11 22:06:06 +02:00
|
|
|
MatematWebserver(**config).start()
|
2018-09-15 02:12:16 +02:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|