init projecty

This commit is contained in:
2018-03-13 15:04:26 +11:00
commit 022fea22e2
8 changed files with 219 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
next-dashboard
vendor
Generated
+73
View File
@@ -0,0 +1,73 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
branch = "master"
name = "github.com/gin-contrib/sse"
packages = ["."]
revision = "22d885f9ecc78bf4ee5d72b937e4bbcdc58e8cae"
[[projects]]
name = "github.com/gin-gonic/gin"
packages = [
".",
"binding",
"render"
]
revision = "d459835d2b077e44f7c9b453505ee29881d5d12d"
version = "v1.2"
[[projects]]
name = "github.com/golang/protobuf"
packages = ["proto"]
revision = "925541529c1fa6821df4e44ce2723319eb2be768"
version = "v1.0.0"
[[projects]]
name = "github.com/jinzhu/gorm"
packages = ["."]
revision = "6ed508ec6a4ecb3531899a69cbc746ccf65a4166"
version = "v1.9.1"
[[projects]]
branch = "master"
name = "github.com/jinzhu/inflection"
packages = ["."]
revision = "04140366298a54a039076d798123ffa108fff46c"
[[projects]]
name = "github.com/mattn/go-isatty"
packages = ["."]
revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39"
version = "v0.0.3"
[[projects]]
name = "github.com/ugorji/go"
packages = ["codec"]
revision = "9831f2c3ac1068a78f50999a30db84270f647af6"
version = "v1.1"
[[projects]]
branch = "master"
name = "golang.org/x/sys"
packages = ["unix"]
revision = "c28acc882ebcbfbe8ce9f0f14b9ac26ee138dd51"
[[projects]]
name = "gopkg.in/go-playground/validator.v8"
packages = ["."]
revision = "5f1438d3fca68893a817e4a66806cea46a9e4ebf"
version = "v8.18.2"
[[projects]]
name = "gopkg.in/yaml.v2"
packages = ["."]
revision = "7f97868eec74b32b0982dd158a51a446d1da7eb5"
version = "v2.1.1"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "86568bef8fd4f3101b0a69d615c6fa4ed13082ce6d10af3b5d8d91d90f7c7c35"
solver-name = "gps-cdcl"
solver-version = 1
+38
View File
@@ -0,0 +1,38 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true
[[constraint]]
name = "github.com/gin-gonic/gin"
version = "1.2.0"
[[constraint]]
name = "github.com/jinzhu/gorm"
version = "1.9.1"
[prune]
go-tests = true
unused-packages = true
+22
View File
@@ -0,0 +1,22 @@
config:
name: dex-prod
frequency: 5s
db:
url: 'xxx'
type: postgres
checks:
- table: contracts
field: someuuid
value: xxxxxx
- table: dispatches
- table: resources
- table: contracts
http:
checks:
- url: https://api.dev.dexdev.greensync.xyz/health/contracts
- url: https://docs.dev.dexdev.greensync.xyz/health
- url: http://app.dev.dexdev.greensync.xyz/health
event:
checks:
- name: 'contracts'
+9
View File
@@ -0,0 +1,9 @@
package controllers
import (
"github.com/gin-gonic/gin"
)
func InitDB(c *gin.Context) {
}
+35
View File
@@ -0,0 +1,35 @@
package main
import (
"io/ioutil"
"github.com/sirupsen/logrus"
"gopkg.in/yaml.v2"
"github.com/gin-gonic/gin"
"github.com/wahyd4/next-dashboard/controllers"
"github.com/wahyd4/next-dashboard/models"
)
func init() {
content, err := ioutil.ReadFile("./config.yaml")
if err != nil {
logrus.Fatalf("Can't read config file: %v", err)
}
var config models.Configuration
err = yaml.Unmarshal(content, &config)
if err != nil {
logrus.Fatalf("Can't unmashal yaml config: %v", err)
}
spew.Dump()
}
func main() {
server := gin.Default()
server.POST("/configurations/init-db", controllers.InitDB)
server.Run()
}
+33
View File
@@ -0,0 +1,33 @@
package models
import "github.com/jinzhu/gorm"
type Configuration struct {
gorm.Model
Name string `json:"name"`
Frequency string `json:"frequency"`
DB *DBConfig `json:"db"`
HTTP *HTTPConfig `json:"http"`
Event *EventConfig `json:"event"`
}
type DBConfig struct {
URL string `json:"url"`
DBType string `json:"dbType"`
}
type HTTPConfig struct {
Checks []*HTTPCheck `json:"check"`
}
type HTTPCheck struct {
URL string `json:"url"`
}
type EventConfig struct {
Checks []*EventCheck `json:"checks"`
}
type EventCheck struct {
Name string `json:"name"`
}
+7
View File
@@ -0,0 +1,7 @@
package request_objects
type InitDatabaseRequest struct {
URL string `json:"url"`
DBType string `json:"dbType"`
}