gol(go link) is a url shortner that run in cli and browser.
To install, use go get
or dockerhub
$ go get github.com/matsu-chara/gol
you can use gol as a server or cli
# run server at localhost:5656
$ gol server
# or run in background and restart always
$ docker-compose up -d
https://localhost:5656/
will show link list and some form for registering or deleting.
access https://localhost:5656/api/dump
dumps all links.
access https://localhost:5656/${key}
will return redirect response destinating to the ${value}
curl -X PUT -d value=${some_url} https://localhost:5656/${key}"
will add a link to key
curl -X PUT -d "value=${some_url}&force=true" https://localhost:5656/${key}
will add a link to key (if replace key when conflict)
curl -X PUT -d "value=${some_url}®isteredBy=bar" https://localhost:5656/${key}
will add a link to key with a registeredBy "bar".
curl -X DELETE https://localhost:5656/${key}
delete a link
curl -X DELETE https://localhost:5656/${key}?registeredBy=bar
delete a link which have registerdBy=bar. (if registeredBy is not equal to the server data, request will fail.)
Open Chrome > Preference > add Search Engine > add below
- name: gol
- keyword: gol
- query: https://localhost:5656/%s
then, you can open gol links by click url bar > type 'gol' > tab > type key > enter
As a further advanced usage, you can set custom name space.
example 1. env specific links.
- name: gop
- keyword: gop
- query: https://localhost:5656/production_%s
example 2. my original links. (prevent contamination of the global namespace)
- name: gom
- keyword: gom
- query: https://localhost:5656/matsu_chara_%s
$ gol add confluence https://confluence.nice-company.com
$ gol add myproduct https://github.nice-company.com/myteam/myproduct
$ gol add myteamdocs https://confluence.nice-company.com/pages/viewpage.action?pageId=xxxxxxx
$ gol add jenkins_dev https://dev.jenkins.nice-company.com/
$ gol add jenkins_prod https://dev.jenkins.nice-company.com/
$ gol add consul_prod https://our-server01:8500/
$ gol add myproduct_admin_prod https://our-server02:9534
$ gol ls
confluence: https://confluence.nice-company.com
consul_prod: https://our-server01:8500/
jenkins_dev: https://dev.jenkins.nice-company.com/
jenkins_prod: https://dev.jenkins.nice-company.com/
myproduct: https://github.nice-company.com/myteam/myproduct
myproduct_admin_prod: https://our-server02:9534
myteamdocs: https://confluence.nice-company.com/pages/viewpage.action?pageId=xxxxxxx
$ gol get jenkins_dev
https://dev.jenkins.nice-company.com/
$ gol rm consul_prod
$ gol get consul_prod
https://gist.github.com/3tty0n/0ef541bb9fce758c4c064ce96ba83a91