In this article, I'm gonna introduce the changes that came with the second major release of the paste ephemeral pastebin tool.
- cleaned up data storage providers and UoWs
- isolated form validation, defined proper types
- optimized view filters
- isolated configuration
- changed router library
- simplified and disambiguated key id format
- unified error handling
- updated code to Go 1.13
- re-wrote the logging
- integrated second-server prometheus monitoring
- now logging HTTP requests
- now supporting and recommending
- now able to provide the configuration folder path through a CLI argument
- now using a common generic HTTP error page design and format
- now providing a markdown-rendering service
- deprecating the
.yamlconfiguration format, due to its ambigous format. Use
Paste needed some fresh air, especially since the version was quickly (i.e. badly) done, with lots of bad practices, clunky code, and hard-to-maintain choices.
The first step consisted on cleaning pretty much the entire code-base.
Once that was done, I decided to provide the two "small" features:
- the CLI argument, to be able to customize where the configuration would be searched;
- the prometheus statistics, to be able to have a nice dashboard to look at.
Discussing with a friend made me realise the void that are pastebin tools for markdown content. So, I decided to implement a dumb commonmark view, as proof of concept.
Which means that paste now supports Markdown rendering!
The last step was about error pages.
Before this change, you'd end up on a crashed
text/plain; charset=ascii page
that would just dump the error without anything else.
I decided to make some quick'n'dumb generic HTML error page for 404, 500, etc.