2022-01-23 06:51:31 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# GmCapsule: Extensible Server for Gemini and Titan
|
|
|
|
#
|
|
|
|
# Copyright (c) 2022 Jaakko Keränen <jaakko.keranen@iki.fi>
|
|
|
|
# License: BSD 2-Clause
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
|
2022-02-05 15:38:12 +00:00
|
|
|
import gmcapsule
|
2022-01-23 12:07:26 +00:00
|
|
|
from pathlib import Path
|
2022-01-23 06:51:31 +00:00
|
|
|
|
2022-02-05 15:38:12 +00:00
|
|
|
VERSION = gmcapsule.__version__
|
2022-01-23 06:51:31 +00:00
|
|
|
|
2022-01-24 06:44:17 +00:00
|
|
|
print(f"GmCapsule v{VERSION}")
|
2022-01-23 06:51:31 +00:00
|
|
|
|
2022-01-23 12:07:26 +00:00
|
|
|
argp = argparse.ArgumentParser(description='GmCapsule is an extensible server for Gemini and Titan.')
|
2022-01-27 09:41:36 +00:00
|
|
|
argp.add_argument('-c', '--config',
|
|
|
|
dest='config_file',
|
|
|
|
default=Path.home() / '.gmcapsulerc',
|
|
|
|
help='Configuration file to load at startup')
|
|
|
|
argp.add_argument('--trace-malloc',
|
|
|
|
action='store_true',
|
|
|
|
help='Enable memory allocation tracing (for debugging)')
|
2022-01-23 12:07:26 +00:00
|
|
|
args = argp.parse_args()
|
2022-01-23 06:51:31 +00:00
|
|
|
|
2022-02-05 15:38:12 +00:00
|
|
|
cfg = gmcapsule.Config(args.config_file)
|
2022-01-27 09:41:36 +00:00
|
|
|
cfg.debug_memtrace = args.trace_malloc
|
2022-02-05 15:38:12 +00:00
|
|
|
capsule = gmcapsule.Capsule(cfg)
|
2022-01-23 06:51:31 +00:00
|
|
|
capsule.run()
|