7 releases
0.3.4 | Jan 12, 2022 |
---|---|
0.3.3 | Dec 13, 2021 |
0.2.2 | Nov 26, 2021 |
#22 in #webpack
22 downloads per month
145KB
359 lines
Toothpaste
A pastebin written in Rust.
Requirements
- https://crates.io/crates/sqlx-cli: Database management
- https://yarnpkg.com/: Asset management
Install
Set a DATABASE_URL
environment variable (eg DATABASE_URL=sqlite://sqlite.db
). Then, init the database:
sqlx database create
sqlx migrate run
Build static assets:
yarn
yarn run build
Launch the http server:
toothpaste --ip 127.0.0.1 --port 8080 # default values
Finally, setup a cron every minute for paste expire cleanup:
* * * * * wget -q -O /dev/null "http(s)://your_host/paste/cleanup"
Development
For easier development, use https://github.com/watchexec/cargo-watch to auto-compile on change:
cargo watch -x 'run'
Auto-compile static assets:
yarn run start
Dependencies
~23–35MB
~525K SLoC