Browse Source

- Added overriding the existing build files

- Fixed schema generation
dependabot/npm_and_yarn/web/prismjs-1.21.0
Max Schmitt 8 years ago
parent
commit
678c6184df
  1. 2
      Makefile
  2. 2
      README.md
  3. 3
      build/schema.go
  4. 5
      descriptor.json
  5. 53
      schema.json

2
Makefile

@ -22,7 +22,7 @@ getGoDependencies:
go get -v ./... go get -v ./...
buildProject: buildProject:
@cd build && go build schema.go && ./schema go run build/schema.go
@mkdir releases @mkdir releases
gox -output="releases/{{.OS}}_{{.Arch}}/{{.OS}}_{{.Arch}}" 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/config.json {} \;

2
README.md

@ -41,7 +41,7 @@ TODO: Add config parameters
### Google ### 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 ## Clients

3
build/schema.go

@ -4,13 +4,14 @@ import (
"flag" "flag"
"io/ioutil" "io/ioutil"
"log" "log"
"path/filepath"
"github.com/maxibanki/golang-url-shortener/config" "github.com/maxibanki/golang-url-shortener/config"
"github.com/urakozz/go-json-schema-generator" "github.com/urakozz/go-json-schema-generator"
) )
func main() { 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() flag.Parse()
schema := generator.Generate(&config.Configuration{}) schema := generator.Generate(&config.Configuration{})
if err := ioutil.WriteFile(*schemaPath, []byte(schema), 644); err != nil { if err := ioutil.WriteFile(*schemaPath, []byte(schema), 644); err != nil {

5
descriptor.json

@ -10,7 +10,10 @@
"files": [ "files": [
{ {
"includePattern": "releases/(.*\\.tar\\.bz2)", "includePattern": "releases/(.*\\.tar\\.bz2)",
"uploadPattern": "$1" "uploadPattern": "$1",
"matrixParams": {
"override": true
}
} }
], ],
"publish": true "publish": true

53
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"
}
}
}
}
}
Loading…
Cancel
Save