# jio
Url shortener
## Set up
* Define a comma separated url mapping file, e.g.
```
trpl,https://doc.rust-lang.org/book/
```
* Place the file in the `$HOME/.jio_redirects` (the home of the user that will be running j.io daemonized)
* **OR**, specify `JIO_REDIRECTS_FILE` to the environment
* Map j.io to localhost in `etc/hosts` (e.g. add this line to it: `127.0.0.1 j.io`)
* Run this on port 80, ideally in some sort of automated daemon that starts on boot.
* Running `sudo setcap 'cap_net_bind_service=+ep' <path to jio>/jio` lets this binary to bind to priveleged ports on Linux
* You can use the example `jio.service` file as a guide if you use systemd (Linux).
* You can specify a `JIO_PORT` environment variable for alternate ports.
* You can specify a `JIO_LISTEN` environment variable for alternate addresses.
* Adding new short urls is as simple as editing the filel and restarting the server/service.
* e.g. make edits, and `sudo systemctl restart jio`