diff --git a/Makefile b/Makefile index 1daa647..9aa5cc4 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ getGoDependencies: go get -v ./... buildProject: - @cd build && go build schema.go && ./schema + 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 {} \; diff --git a/README.md b/README.md index bc05a19..ba32e14 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ TODO: Add config parameters ### Google -Visit [console.cloud.google.com](https://console.cloud.google.com), create or use an existing project, goto `APIs & Services` -> `Credentials` and create there an `OAuth Client-ID` for the application type `Webapplicaton`. There you get the Client-ID and ClientSecret for your configuration. It's important, that you set in the Google Cloud Platform `YOUR_URL/api/v1/callback` as authorized redirect URLs. +Visit [console.cloud.google.com](https://console.cloud.google.com), create or use an existing project, goto `APIs & Services` -> `Credentials` and create there an `OAuth Client-ID` for the application type `Webapplicaton`. There you get the Client-ID and ClientSecret for your configuration. It's important, that you set in the Google Cloud Platform `YOUR_URL/api/v1/callback` as authorized redirect URLs. ## Clients diff --git a/build/schema.go b/build/schema.go index 9beac86..43f0a78 100644 --- a/build/schema.go +++ b/build/schema.go @@ -4,13 +4,14 @@ 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", "schema.json", "location of the converted schema") + 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), 644); err != nil { diff --git a/descriptor.json b/descriptor.json index 89b2579..a72dc50 100644 --- a/descriptor.json +++ b/descriptor.json @@ -10,7 +10,10 @@ "files": [ { "includePattern": "releases/(.*\\.tar\\.bz2)", - "uploadPattern": "$1" + "uploadPattern": "$1", + "matrixParams": { + "override": true + } } ], "publish": true diff --git a/schema.json b/schema.json new file mode 100644 index 0000000..58f3966 --- /dev/null +++ b/schema.json @@ -0,0 +1,53 @@ +{ + "$schema": "http://json-schema.org/schema#", + "type": "object", + "properties": { + "$schema": { + "type": "string" + }, + "Handlers": { + "type": "object", + "properties": { + "BaseURL": { + "type": "string" + }, + "EnableGinDebugMode": { + "type": "boolean" + }, + "ListenAddr": { + "type": "string" + }, + "OAuth": { + "type": "object", + "properties": { + "Google": { + "type": "object", + "properties": { + "ClientID": { + "type": "string" + }, + "ClientSecret": { + "type": "string" + } + } + } + } + }, + "Secret": { + "type": "string" + } + } + }, + "Store": { + "type": "object", + "properties": { + "DBPath": { + "type": "string" + }, + "ShortedIDLength": { + "type": "integer" + } + } + } + } +} \ No newline at end of file