From c0765a1e48bc191dc87cbcd93d81d3b8eed613c1 Mon Sep 17 00:00:00 2001 From: kreativmonkey Date: Mon, 3 Jul 2017 20:57:45 +0200 Subject: [PATCH] Add the Flags to Doku --- README.md | 24 +++++++++++++++++++----- config.go | 2 -- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0be8509..4d9731a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Sgot -Sgot is a lightwaight, self-hostable open-source link shortening web application with a Restful API. It allows you to host your own URL shortener to gain control over you data. Shrt is inspired by [Polr](https://polr.me/index.php), a php based url shortener. +Sgot is a lightwaight, self-hostable open-source link shortening web application with a Restful API. It allows you to host your own URL shortener to gain control over you data. Shrt is inspired by [Polr](https://polr.me/index.php), a php based url shortener. ## Features @@ -11,6 +11,20 @@ Sgot is a lightwaight, self-hostable open-source link shortening web application - [ ] Delete URL - [ ] Login +## Installation + +Clone the Repository and build the Application by using `go build .` + +Start Sgot by the following commant `./sgot &` + +| Flag | Usage | Default | +| -------- | -------------------------------------- | ------------------------------------ | +| -host | setup the host to listen on | localhost | +| -port | Setup the port to listen on | 6889 | +| -apikey | Define the key to connect with the API | "thisIsNotASecretTokenNow" | +| -db-file | Setup the DB file to use | ./sgot.db | +| -title | Service title | Sgot | +| -domain | Domain for the redirection link | The domain your service is available | ## API To authenticate a user to Polr, you will need to provide an API key along with each request to the Polr API, as a GET or POST parameter. (e.g ``?key=API_KEY_HERE``) @@ -27,7 +41,7 @@ Short an URL ``` GET: http://example.com/api/action/shorten?key=API_KEY_HERE&url=http://example.de/shortening/main?q=5x -Response: +Response: { "action": "shorten", "result": "https://example.com/5kq" } ``` @@ -43,19 +57,19 @@ Lookup for existing URL ``` GET: http://example.com/api/action/lookup?key=API_KEY_HERE&url_ending=5kq -Response: +Response: { "action":"lookup", "result": { "long_url": "http://example.de/shortening/main?q=5x", "created_at": "2017-05-12 22:48:40.997520107 +0200 CEST", - "clicks":"0" + "clicks":"0" } } ``` ## ToDo -* Add more Statistik details like the clicks from Country and Referer. +* Add more Statistik details like the clicks from Country and Referer. * Implements the correct HTTP Error Codes * Add config File * Secure the API with API Key [optional] diff --git a/config.go b/config.go index 5b30cde..745b2ed 100644 --- a/config.go +++ b/config.go @@ -13,7 +13,6 @@ func DefaultConfig() Config { Host: "localhost", Port: "6889", Title: "Sgot", - CheckDomain: false, } } @@ -55,7 +54,6 @@ func readConfig(f *flag.FlagSet, args []string) (*Config, error){ f.StringVar(&config.DB, "db-file", config.DB, "The db file to use") f.StringVar(&config.Domain, "domain", config.Domain, "The domain for redirect links") f.StringVar(&config.Title, "title", config.Title, "The title on the Front") - f.BoolVar(&config.CheckDomain, "check-domain", config.CheckDomain, "Do you want to check Domain? Default:") // Arguments variables err = f.Parse(args)