go-anhgelus
go-anhgelus is a URL Shortener web application.
Installation
There are two ways to install the application: docker and build.
Docker
- Clone the repository
$ git clone https://github.com/anhgelus/go-anhgelus.git
- Go into the repository, rename
.env.example
into .env
and customize it: add the wanted links to be shortened.
- Start the compose file
$ docker compose up -d --build
Build
- Clone the repository
$ git clone https://github.com/anhgelus/go-anhgelus.git
- Install Go 1.22+
- Go into the repository and build the program
$ go build .
- Run the application through bash (or PowerShell if you are on windows)
Usage
go-anhgelus
and go-anhgelus -h
show the help
go-anhgelus run
runs the application
go-anhgelus config {path} {url}
creates (or edit) a config at the given path for shortening the given url
go-anhgelus config foo.toml example.org
will create a config at config/foo.toml
with a shortening link for
example
.org
Config
Every config files are in config
folder.
They followed this template:
[[links]]
id = "slug"
link = "https://foo.example.org"
[[links]].id
is the slug used. You can modify it.
[[links]].link
is the shortened link.
You can create as many config files as you want.
It also supports config is subdirectories
Technologies
- Go 1.22
- gorilla/mux
- anhgelus/human-readable-slug
- pelletier/go-toml