Simple HTTP redirection service
|
11 달 전 | |
---|---|---|
.github | 11 달 전 | |
internal | 11 달 전 | |
.gitignore | 11 달 전 | |
Dockerfile | 11 달 전 | |
LICENSE.md | 11 달 전 | |
README.md | 11 달 전 | |
go.mod | 11 달 전 | |
go.sum | 11 달 전 | |
main.go | 11 달 전 |
A simple redirection service that routes any path to any URL - or in brief, a short URL service, depending on the length of your domain name.
Build the app first:
go build -o shorty
You can use --help
or -h
with any command to learn more about Shorty usage.
./shorty --help
Start the app:
./shorty start
Shorty can be configured via CLI flags or environment variables. Refer to help text for more detail.
The most important flag is --token|-t|SHORTY_TOKEN
which is unset by default, meaning that authentication is not enabled and anyone can modify your redirects. Set a token secretly and add it to your client to prevent unauthenticated access.
You can use the following commands to manage your redirects:
shorty add <path> <destination>
adds a redirectshorty rm <path>
removes a redirectshorty get <path>
gets the destination of a redirectThese commands connect to the running Shorty instance, so you need to make sure you have started it first. Make sure to set --token|-t|SHORTY_TOKEN
as well if you have enabled token authentication.
If you provide --url|-u|SHORTY_URL
then you can use Shorty as a remote CLI. By default it will connect to the local Shorty instance.
Since all Shorty interaction goes through a REST API, it's easy to use another client (such as Postman) or develop your own client to manage Shorty. This is left as an exercise for the reader.
See LICENSE.md