AlbinoDrought / creamy-shortener

Barebones link "shortener" using multihashes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Creamy Shortener

albinodrought/creamy-shortener Docker Pulls AGPL-3.0 License

Barebones link "shortener" using multihashes: identical URLs will always shorten to the same shortened links.

Shortening

curl -X POST -d "link=https://example.com/foo?bar" "https://your.shortener/shorten"

Output:

https://your.shortener/l/Qma3YMYZUNAY7Dp7UhtZfqKAfsLkHyF9jf1yFXjZbYjWqt

Building

Without Docker

go get -d -v
go build

With Docker

docker build -t albinodrought/creamy-shortener .

Running

CREAMY_APP_URL="https://your.shortener/" \
CREAMY_DATA_PATH=/data \
CREAMY_HASH_MODE=sha2-256 \
CREAMY_HTTP_PORT=80 \
CREAMY_POPULATED_HOSTS=localhost,example.com \
./creamy-shortener
  • CREAMY_APP_URL: the externally-accessible URL this instance can be reached at, defaults to http://localhost:3000/

  • CREAMY_DATA_PATH: the path to persist all data, defaults to ./data

  • CREAMY_HASH_MODE: multihash mode to use, defaults to sha2-256

  • CREAMY_HTTP_PORT: port to listen on, defaults to 3000

  • CREAMY_POPULATED_HOSTS: hosts (including port) to allow link shortening for, defaults to localhost

About

Barebones link "shortener" using multihashes

License:GNU Affero General Public License v3.0


Languages

Language:Go 96.6%Language:Dockerfile 3.4%