M README.md => README.md +0 -1
@@ 8,7 8,6 @@ The old Go-based project is now available at [`~artemis/paste-go`](https://git.s
## WIP: TODO
-- CLI args
- Man pages: using scdoc
- Daemon (cli args, gunicorn, reverse proxy)
- `.ini` config format
M paste/config.py => paste/config.py +3 -1
@@ 20,7 20,7 @@ model = t.Dict({
default_config_paths = [
'paste.ini',
- Path(getenv('HOME')) / '.config',
+ Path(getenv('HOME')) / '.config' / 'paste.ini',
'/etc/paste.ini',
]
@@ 40,5 40,7 @@ def get_config(file: Optional[str] = None) -> dict:
if None is not config_path:
c.read(config_path)
+ elif None is not file and None is config_path:
+ raise FileNotFoundError(f'file not found at {file}')
return model.check({s: dict(c.items(s)) for s in c.sections()})
M paste/server.py => paste/server.py +7 -1
@@ 1,3 1,5 @@
+import argparse
+
from aiohttp import web
from .config import get_config
@@ 6,7 8,11 @@ from .store import startup_store
from .views import routes, views
if __name__ == '__main__':
- config = get_config()
+ parser = argparse.ArgumentParser(description='Ephemeral pastebin server')
+ parser.add_argument('-c', '--config', help='path to the configuration file')
+ args = parser.parse_args()
+
+ config = get_config(args.config)
app = web.Application()
app['config'] = config