M README.md => README.md +2 -3
@@ 8,6 8,5 @@ The old Go-based project is now available at [`~artemis/paste-go`](https://git.s
## WIP: TODO
-- Man pages: using scdoc
- - Daemon (cli args, gunicorn, reverse proxy)
- - `.ini` config format
+- setup.py
+- Packaging
M man/paste.scd => man/paste.scd +18 -1
@@ 24,7 24,24 @@ Configuration-related documentation is provided in the joined manual page.
# HOSTING
-WIP: standalone, reverse proxy behind caddy
+By default, the daemon is meant to be easily run without any additional component,
+making it perfect for a small locally-hosted setup.
+
+However, it is not meant to be publicly exposed right away, as it isn't meant to
+handle TLS traffic.
+
+For this purpose, you should set it up behind a reverse proxy, such as NGINX or Caddy.
+
+## Static resources
+
+Static resources should ideally be provided by the reverse proxy.
+
+To obtain the path at which static resources are installed on your server,
+you may run the following command.
+
+```
+$ python -m paste
+```
# SEE ALSO
M man/pasteini.scd => man/pasteini.scd +43 -2
@@ 18,11 18,52 @@ Multiple sections exist to configure different aspects of the paste daemon.
## HTTP SERVER
-TODO WIP
+Every key under the `[http]` section is used to configure the HTTP server.
+
+The following keys are available.
+
+*host*
+ Configures the HTTP listening IP (defaults to `127.0.0.1`).
+
+*port*
+ Configures the server listening port (defaults to `3000`).
## REDIS STORE
-TODO WIP
+Every key under the `[redis]` section is used to configure the Redis
+store connection.
+
+The following keys are available.
+
+*uri*
+ The redis DB uri, of the form `redis://host[:port/[db[?parameters]]]`
+ (defaults to `redis://localhost:6379/0`).
+
+ The full address format is documented on the aioredis documentation:
+
+ https://aioredis.readthedocs.io/en/v1.3.0/api_reference.html#connection
+
+*db*
+ The database number (defaults to nothing, in which case the database number
+ should be given in the URI).
+
+*password*
+ The server password (defaults to nothing), if needed.
+
+## Example
+
+The following configuration is an example configuration using all keys.
+
+```
+[http]
+host=192.168.1.2
+port=8080
+
+[redis]
+uri=redis://192.168.1.1/
+db=3
+password='Meow'
+```
# SEE ALSO
M paste/__init__.py => paste/__init__.py +2 -0
@@ 1,3 1,5 @@
import pathlib
base_dir = pathlib.Path(__file__).parent
+static_dir = base_dir / 'static'
+templates_dir = base_dir / 'templates'
A paste/__main__.py => paste/__main__.py +5 -0
@@ 0,0 1,5 @@
+from . import static_dir
+
+print('Paste')
+print('-----')
+print(f'Static resources root: {static_dir}')
M paste/views.py => paste/views.py +3 -3
@@ 12,10 12,10 @@ from pygments import highlight
from pygments.formatters.html import HtmlFormatter
from pygments.lexers import guess_lexer, get_all_lexers, get_lexer_by_name
-from . import base_dir
+from . import templates_dir, static_dir
r = web.RouteTableDef()
-r.static('/static', base_dir / 'static')
+r.static('/static', static_dir)
async def routes(app: Application): app.router.add_routes(r)
@@ 24,7 24,7 @@ async def routes(app: Application): app.router.add_routes(r)
async def views(app: Application):
template_setup(
app,
- loader=jinja2.FileSystemLoader(str(base_dir / 'templates')))
+ loader=jinja2.FileSystemLoader(str(templates_dir)))
env = get_env(app)
env.filters['lineno'] = lambda val: '\n'.join([str(x + 1) for x in range(len(val.split('\n')))])
env.filters['markdown'] = lambda val: do_mark_safe(markdown(val, extensions=[