Templates: embed the templates in-binary

Rocket's templating is not exactly friendly when it comes to embedding
in-binary. Rocket's template fairing requires a `template_dir` directory
pointing to the directory containing templates.
A quick workaround to this would be to have custom fairings with
`template_dir` merged with the value `.`
But in bare-metal scenarios like what docker's scratch image mimics, we
don't exactly have a '.' file, so instead for this very project, I have
to point the `template_dir` to the `upload` folder, which is created by
`bin` on execution. Checkout the Dockerfile for more info

Signed-off-by: Gunwant Jain <mail@wantguns.dev>
This commit is contained in:
Gunwant Jain
2022-01-18 21:33:03 +05:30
parent 78b4213c62
commit 3a541aed23
3 changed files with 46 additions and 20 deletions

View File

@@ -4,9 +4,9 @@ services:
image: wantguns/bin
container_name: pastebin
ports:
- 127.0.0.1:6162:6162
- 127.0.0.1:6163:6163
environment:
- ROCKET_PORT=6162
- ROCKET_LIMITS={form="16 MiB"}
- BIN_PORT=6163
- BIN_LIMITS={form="16 MiB"}
volumes:
- ./upload:/app/upload # upload folder will have your pastes
- ./upload:/upload # upload folder will have your pastes