From dcfdeaa170f6efdc36adc9b66bdd4f830c12a2b0 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Fri, 10 Nov 2017 13:54:14 +0100 Subject: [PATCH] - removed overpowered schema generation - fixed unit test bug - moved most of the docu to the github wiki --- Makefile | 2 -- README.md | 39 +++++---------------------------------- build/config.json | 1 - build/schema.go | 20 -------------------- build/schema.md | Bin 4248 -> 0 bytes config/config.go | 25 ++++++++++++------------- handlers/auth_test.go | 3 +-- handlers/handlers.go | 10 ++++++---- main.go | 2 +- 9 files changed, 25 insertions(+), 77 deletions(-) delete mode 100644 build/schema.go delete mode 100644 build/schema.md diff --git a/Makefile b/Makefile index 1ace631..0c75336 100644 --- a/Makefile +++ b/Makefile @@ -21,9 +21,7 @@ getGoDependencies: go get -v ./... buildProject: - go run build/schema.go @mkdir releases gox -output="releases/{{.OS}}_{{.Arch}}/{{.OS}}_{{.Arch}}" find releases -maxdepth 1 -mindepth 1 -type d -exec cp build/config.json {} \; - find releases -maxdepth 1 -mindepth 1 -type d -exec cp build/schema.json {} \; find releases -maxdepth 1 -mindepth 1 -type d -exec tar -cvjf {}.tar.bz2 {} \; diff --git a/README.md b/README.md index e5abe93..67bc05d 100644 --- a/README.md +++ b/README.md @@ -19,25 +19,12 @@ - Easy [ShareX](https://github.com/ShareX/ShareX) integration - Dockerizable -## Server Installation +## Documenation -### Standard - -Download the package for your architecture and operating system from [bintray](https://bintray.com/maxibanki/golang-url-shortener/travis-ci) and extract it. - -### Docker - -TODO - -## Configuration - -The configuration is a JSON file, an example is located [here](build/config.json). If your editor supports intellisense by using a schema (e.g. [VS Code](https://github.com/Microsoft/vscode)) then you can simply press space for auto completion. The config parameters should be really self explaining, but [here](build/schema.md) is a detailed description for all of these: - -## OAuth - -### Google - -Visit [console.cloud.google.com](https://console.cloud.google.com) and create or use an existing project, go to `APIs & Services` -> `Credentials` and create there an `OAuth Client-ID` for the application type `Webapplicaton`. There you get the Client-ID and the ClientSecret for your configuration. It's important, that you set in the Google Cloud Platform `YOUR_URL/api/v1/callback` as authorized redirect URL. +- [Installation](https://github.com/maxibanki/golang-url-shortener/wiki/Installation) +- [Configuration](https://github.com/maxibanki/golang-url-shortener/wiki/Configuration) +- [Setting up OAuth](https://github.com/maxibanki/golang-url-shortener/wiki/Setting-up-OAuth) +- [ShareX Usage](https://github.com/maxibanki/golang-url-shortener/wiki/ShareX) ## Clients @@ -51,10 +38,6 @@ In general the `POST` endpoints can be called, by using one of the following tec For all the endpoints which are on `/api/v1/protected` there is the `Authorization` header required. -### [ShareX](https://github.com/ShareX/ShareX) - -For ShareX usage, we refer to the menu item in the frontend where your configuration will be generated. There are further information for the detailed use. - ## Why did you built this Just only because I want to extend my current self hosted URL shorter with some features and learn about new techniques like: @@ -64,15 +47,3 @@ Just only because I want to extend my current self hosted URL shorter with some - Makefiles - Travis CI - Key / Value databases - -## Utils - -### Update Config Documentation - -``` -yarn global add jsonschema-md -go run build/schema.go -jsonschema-md.cmd build/schema.json > build/schema.md -``` - -After that adjust the title to `Configuration` and the description to `Golang URL Shortener Configuration`. \ No newline at end of file diff --git a/build/config.json b/build/config.json index 26edcd3..26590ad 100644 --- a/build/config.json +++ b/build/config.json @@ -1,5 +1,4 @@ { - "$schema": "./schema.json", "Store": { "DBPath": "main.db", "ShortedIDLength": 4 diff --git a/build/schema.go b/build/schema.go deleted file mode 100644 index b8c31d4..0000000 --- a/build/schema.go +++ /dev/null @@ -1,20 +0,0 @@ -package main - -import ( - "flag" - "io/ioutil" - "log" - "path/filepath" - - "github.com/maxibanki/golang-url-shortener/config" - "github.com/urakozz/go-json-schema-generator" -) - -func main() { - schemaPath := flag.String("path", filepath.Join("build", "schema.json"), "location of the converted schema") - flag.Parse() - schema := generator.Generate(&config.Configuration{}) - if err := ioutil.WriteFile(*schemaPath, []byte(schema), 755); err != nil { - log.Fatalf("could not write schema: %v", err) - } -} diff --git a/build/schema.md b/build/schema.md deleted file mode 100644 index d972ddfe6cb09698af1224580b3e65950ea2a7bd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4248 zcmds)T~AX%5QgX4#Q(4fCa6*L(s0LD6oN{qgbQLwzi6xdvZWvizg>Nwoi69Jrw6DZ zCX$o3XLo03XJ_7dXZrisiUr%Uf%WaoI@Yp@jjU?tdS~vbJ&B(c^C#FByRxA*ZC(2Y zRI_MO;==)p#`cO)%e?YSb*o|}C!-J6etYn$I6qW`>$^4es^2BMMMWo}r8%{qyZgA@@@&uYHebk=t`H0oiZ@87Cwp(RpF6y~ zc^L5_2SOn>`Bj%l_$Er|&a6#EdaO7ne&IgEcQ&&QCGkUe z=tK-Q7GR>PRnLaLemju^>(ZV0FW7}<$=%PkF_m4@Xvfxsdfrx*OXqrqV#GIkdg8~1 zP)^2^l@*g(v9BAcc z%CjK9?{2Ry(@V^19tv-R$g{9sVi&NJuuz7Yyq+Yx9B%R&{^cDX6T-HHEck>9x~n=? z#%M)37zECQxvzwQiGE=k800LXqNg`U)>!Kxn0iV*n~0yN!5OwwrJZFRxHo_DeYm$= zK5y|uTY4KmR^$_}?|+B$Z2w}E-R;+KiX9L& zoqxaHol#5i4fVLDnh1jFJ(%a;himc*?)XQRj<2h=pj_J2cd>iO{!2Gv#_dZZ|0grc z=sh?Gj3!2%m747v@)h56aK74mX6Nzm{nw<>r?B%