https://github.com/albinodrought/creamy-shortener
Barebones link "shortener" using multihashes
https://github.com/albinodrought/creamy-shortener
creamy golang link-shortener
Last synced: about 2 months ago
JSON representation
Barebones link "shortener" using multihashes
- Host: GitHub
- URL: https://github.com/albinodrought/creamy-shortener
- Owner: AlbinoDrought
- License: agpl-3.0
- Created: 2019-10-06T04:05:27.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-10-06T20:52:38.000Z (over 5 years ago)
- Last Synced: 2024-04-14T12:47:19.819Z (about 1 year ago)
- Topics: creamy, golang, link-shortener
- Language: Go
- Homepage:
- Size: 32.2 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Creamy Shortener
Barebones link "shortener" using [multihashes](https://github.com/multiformats/multicodec): 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](https://github.com/multiformats/multicodec/blob/8dd1bfb9a953da79c3ec5962a2a3dcb94e0cc376/table.csv) 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`