|
3 months ago | |
---|---|---|
.drone.yml | 10 months ago | |
.gitignore | 11 months ago | |
Dockerfile | 3 months ago | |
LICENSE | 11 months ago | |
README.md | 11 months ago | |
database.go | 3 months ago | |
example-config.yaml | 11 months ago | |
go.mod | 3 months ago | |
go.sum | 3 months ago | |
main.go | 3 months ago | |
main_test.go | 3 months ago | |
templates.go | 3 months ago |
GoShort is a simple URL shortener written in Go. It's minimal and only uses a simple SQLite database in the background.
Configuration can be done with a simple config.{json|yaml|toml}
file in the working directory or a subdirectory config
.
These are the required config values:
password
: Password to create, update or delete short linksshortUrl
: The short base URL (without trailing slash!)defaultUrl
: The default URL to which should be redirected when no slug is specifiedThese are optional config values:
dbPath
: Relative path where the database should be savedSee the example-config.yaml
file for an example configuration.
The preferred authentication method is Basic Authentication. If you try to create, modify or delete a short link, in the browser a popup will appear asking for username and password. Enter just the password you configured. Alternatively you can append a URL query parameter password
with your configured password.
You can either create, update or delete short links using a browser by entering the short URL and the path for the method. Or you can make a HTTP POST
request with the parameters.
/s
url
: URL to shortenslug
: the preferred slug/u
slug
: slug to updatenew
: new long URL/d
slug
: slug to deleteGoShort is licensed under the MIT license, so you can do basically everything with it, but nevertheless, please contribute your improvements to make GoShort better for everyone. See the LICENSE file.