mirror of https://github.com/statping/statping
github actions
parent
aef93f8dd1
commit
d764117e56
|
@ -151,11 +151,6 @@ func Router() *mux.Router {
|
||||||
api.Handle("/api/checkins/{api}", authenticated(checkinDeleteHandler, false)).Methods("DELETE")
|
api.Handle("/api/checkins/{api}", authenticated(checkinDeleteHandler, false)).Methods("DELETE")
|
||||||
r.Handle("/checkin/{api}", http.HandlerFunc(checkinHitHandler))
|
r.Handle("/checkin/{api}", http.HandlerFunc(checkinHitHandler))
|
||||||
|
|
||||||
// Static Files Routes
|
|
||||||
r.PathPrefix("/files/postman.json").Handler(http.StripPrefix("/files/", http.FileServer(source.TmplBox.HTTPBox())))
|
|
||||||
r.PathPrefix("/files/swagger.json").Handler(http.StripPrefix("/files/", http.FileServer(source.TmplBox.HTTPBox())))
|
|
||||||
r.PathPrefix("/files/grafana.json").Handler(http.StripPrefix("/files/", http.FileServer(source.TmplBox.HTTPBox())))
|
|
||||||
|
|
||||||
// API Generic Routes
|
// API Generic Routes
|
||||||
r.Handle("/metrics", readOnly(prometheusHandler, false))
|
r.Handle("/metrics", readOnly(prometheusHandler, false))
|
||||||
r.Handle("/health", http.HandlerFunc(healthCheckHandler))
|
r.Handle("/health", http.HandlerFunc(healthCheckHandler))
|
||||||
|
|
|
@ -141,9 +141,6 @@ func CreateAllAssets(folder string) error {
|
||||||
CopyToPublic(TmplBox, "", "robots.txt")
|
CopyToPublic(TmplBox, "", "robots.txt")
|
||||||
CopyToPublic(TmplBox, "", "banner.png")
|
CopyToPublic(TmplBox, "", "banner.png")
|
||||||
CopyToPublic(TmplBox, "", "favicon.ico")
|
CopyToPublic(TmplBox, "", "favicon.ico")
|
||||||
CopyToPublic(TmplBox, "files", "swagger.json")
|
|
||||||
CopyToPublic(TmplBox, "files", "postman.json")
|
|
||||||
CopyToPublic(TmplBox, "files", "grafana.json")
|
|
||||||
log.Infoln("Compiling CSS from SCSS style...")
|
log.Infoln("Compiling CSS from SCSS style...")
|
||||||
err := CompileSASS(DefaultScss...)
|
err := CompileSASS(DefaultScss...)
|
||||||
log.Infoln("Statping assets have been inserted")
|
log.Infoln("Statping assets have been inserted")
|
||||||
|
@ -165,11 +162,8 @@ func DeleteAllAssets(folder string) error {
|
||||||
func CopyAllToPublic(box *rice.Box) error {
|
func CopyAllToPublic(box *rice.Box) error {
|
||||||
|
|
||||||
exclude := map[string]bool{
|
exclude := map[string]bool{
|
||||||
"base.gohtml": true,
|
"base.gohtml": true,
|
||||||
"index.html": true,
|
"index.html": true,
|
||||||
"swagger.json": true,
|
|
||||||
"postman.json": true,
|
|
||||||
"grafana.json": true,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err := box.Walk("/", func(path string, info os.FileInfo, err error) error {
|
err := box.Walk("/", func(path string, info os.FileInfo, err error) error {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,611 +0,0 @@
|
||||||
{
|
|
||||||
"swagger": "2.0",
|
|
||||||
"info": {
|
|
||||||
"version": "1.0",
|
|
||||||
"title": "Statping",
|
|
||||||
"description": "Statping API Requests"
|
|
||||||
},
|
|
||||||
"host": "example.com",
|
|
||||||
"basePath": "/",
|
|
||||||
"securityDefinitions": {
|
|
||||||
"auth": {
|
|
||||||
"type": "oauth2",
|
|
||||||
"flow": "implicit",
|
|
||||||
"authorizationUrl": "http://example.com",
|
|
||||||
"scopes": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"schemes": [
|
|
||||||
"http"
|
|
||||||
],
|
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"paths": {
|
|
||||||
"/api": {
|
|
||||||
"get": {
|
|
||||||
"description": "TODO: Add Description",
|
|
||||||
"summary": "Statping Details",
|
|
||||||
"tags": [
|
|
||||||
"Main"
|
|
||||||
],
|
|
||||||
"operationId": "ApiGet",
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"parameters": [],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"auth": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/services": {
|
|
||||||
"get": {
|
|
||||||
"description": "TODO: Add Description",
|
|
||||||
"summary": "View All Services",
|
|
||||||
"tags": [
|
|
||||||
"Services"
|
|
||||||
],
|
|
||||||
"operationId": "ApiServicesGet",
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"parameters": [],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"auth": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"post": {
|
|
||||||
"description": "TODO: Add Description",
|
|
||||||
"summary": "Create Service",
|
|
||||||
"tags": [
|
|
||||||
"Services"
|
|
||||||
],
|
|
||||||
"operationId": "ApiServicesPost",
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "Content-Type",
|
|
||||||
"in": "header",
|
|
||||||
"required": true,
|
|
||||||
"type": "string",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Body",
|
|
||||||
"in": "body",
|
|
||||||
"required": true,
|
|
||||||
"description": "",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/CreateServicerequest"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"auth": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/services/1": {
|
|
||||||
"get": {
|
|
||||||
"description": "TODO: Add Description",
|
|
||||||
"summary": "View Service",
|
|
||||||
"tags": [
|
|
||||||
"Services"
|
|
||||||
],
|
|
||||||
"operationId": "ApiServices1Get",
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"parameters": [],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"auth": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"delete": {
|
|
||||||
"description": "TODO: Add Description",
|
|
||||||
"summary": "Delete Service",
|
|
||||||
"tags": [
|
|
||||||
"Services"
|
|
||||||
],
|
|
||||||
"operationId": "ApiServices1Delete",
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"parameters": [],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"auth": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/services/19": {
|
|
||||||
"post": {
|
|
||||||
"description": "TODO: Add Description",
|
|
||||||
"summary": "Update Service",
|
|
||||||
"tags": [
|
|
||||||
"Services"
|
|
||||||
],
|
|
||||||
"operationId": "ApiServices19Post",
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "Content-Type",
|
|
||||||
"in": "header",
|
|
||||||
"required": true,
|
|
||||||
"type": "string",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Body",
|
|
||||||
"in": "body",
|
|
||||||
"required": true,
|
|
||||||
"description": "",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/UpdateServicerequest"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"auth": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/users": {
|
|
||||||
"get": {
|
|
||||||
"description": "TODO: Add Description",
|
|
||||||
"summary": "View All Users",
|
|
||||||
"tags": [
|
|
||||||
"Users"
|
|
||||||
],
|
|
||||||
"operationId": "ApiUsersGet",
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"parameters": [],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"auth": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"post": {
|
|
||||||
"description": "TODO: Add Description",
|
|
||||||
"summary": "Create User",
|
|
||||||
"tags": [
|
|
||||||
"Users"
|
|
||||||
],
|
|
||||||
"operationId": "ApiUsersPost",
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "Content-Type",
|
|
||||||
"in": "header",
|
|
||||||
"required": true,
|
|
||||||
"type": "string",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Body",
|
|
||||||
"in": "body",
|
|
||||||
"required": true,
|
|
||||||
"description": "",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/CreateUserrequest"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"auth": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/users/1": {
|
|
||||||
"get": {
|
|
||||||
"description": "TODO: Add Description",
|
|
||||||
"summary": "View User",
|
|
||||||
"tags": [
|
|
||||||
"Users"
|
|
||||||
],
|
|
||||||
"operationId": "ApiUsers1Get",
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"parameters": [],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"auth": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/users/4": {
|
|
||||||
"post": {
|
|
||||||
"description": "TODO: Add Description",
|
|
||||||
"summary": "Update User",
|
|
||||||
"tags": [
|
|
||||||
"Users"
|
|
||||||
],
|
|
||||||
"operationId": "ApiUsers4Post",
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "Content-Type",
|
|
||||||
"in": "header",
|
|
||||||
"required": true,
|
|
||||||
"type": "string",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Body",
|
|
||||||
"in": "body",
|
|
||||||
"required": true,
|
|
||||||
"description": "",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/UpdateUserrequest"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"auth": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"delete": {
|
|
||||||
"description": "TODO: Add Description",
|
|
||||||
"summary": "Delete User",
|
|
||||||
"tags": [
|
|
||||||
"Users"
|
|
||||||
],
|
|
||||||
"operationId": "ApiUsers4Delete",
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"parameters": [],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"auth": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"definitions": {
|
|
||||||
"CreateServicerequest": {
|
|
||||||
"title": "Create ServiceRequest",
|
|
||||||
"example": {
|
|
||||||
"name": "New Service",
|
|
||||||
"domain": "https://google.com",
|
|
||||||
"expected": "",
|
|
||||||
"expected_status": 200,
|
|
||||||
"check_interval": 15,
|
|
||||||
"type": "http",
|
|
||||||
"method": "GET",
|
|
||||||
"post_data": "",
|
|
||||||
"port": 0,
|
|
||||||
"timeout": 10,
|
|
||||||
"order_id": 0
|
|
||||||
},
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"name": {
|
|
||||||
"description": "",
|
|
||||||
"example": "New Service",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"domain": {
|
|
||||||
"description": "",
|
|
||||||
"example": "https://google.com",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"expected": {
|
|
||||||
"description": "",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"expected_status": {
|
|
||||||
"description": "",
|
|
||||||
"example": 200,
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"check_interval": {
|
|
||||||
"description": "",
|
|
||||||
"example": 15,
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
"description": "",
|
|
||||||
"example": "http",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"method": {
|
|
||||||
"description": "",
|
|
||||||
"example": "GET",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"post_data": {
|
|
||||||
"description": "",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"port": {
|
|
||||||
"description": "",
|
|
||||||
"example": 0,
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"timeout": {
|
|
||||||
"description": "",
|
|
||||||
"example": 10,
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"order_id": {
|
|
||||||
"description": "",
|
|
||||||
"example": 0,
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"name",
|
|
||||||
"domain",
|
|
||||||
"expected",
|
|
||||||
"expected_status",
|
|
||||||
"check_interval",
|
|
||||||
"type",
|
|
||||||
"method",
|
|
||||||
"post_data",
|
|
||||||
"port",
|
|
||||||
"timeout",
|
|
||||||
"order_id"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"UpdateServicerequest": {
|
|
||||||
"title": "Update ServiceRequest",
|
|
||||||
"example": {
|
|
||||||
"name": "Updated Service",
|
|
||||||
"domain": "https://google.com",
|
|
||||||
"expected": "",
|
|
||||||
"expected_status": 200,
|
|
||||||
"check_interval": 60,
|
|
||||||
"type": "http",
|
|
||||||
"method": "GET",
|
|
||||||
"post_data": "",
|
|
||||||
"port": 0,
|
|
||||||
"timeout": 10,
|
|
||||||
"order_id": 0
|
|
||||||
},
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"name": {
|
|
||||||
"description": "",
|
|
||||||
"example": "Updated Service",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"domain": {
|
|
||||||
"description": "",
|
|
||||||
"example": "https://google.com",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"expected": {
|
|
||||||
"description": "",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"expected_status": {
|
|
||||||
"description": "",
|
|
||||||
"example": 200,
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"check_interval": {
|
|
||||||
"description": "",
|
|
||||||
"example": 60,
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
"description": "",
|
|
||||||
"example": "http",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"method": {
|
|
||||||
"description": "",
|
|
||||||
"example": "GET",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"post_data": {
|
|
||||||
"description": "",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"port": {
|
|
||||||
"description": "",
|
|
||||||
"example": 0,
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"timeout": {
|
|
||||||
"description": "",
|
|
||||||
"example": 10,
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"order_id": {
|
|
||||||
"description": "",
|
|
||||||
"example": 0,
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"name",
|
|
||||||
"domain",
|
|
||||||
"expected",
|
|
||||||
"expected_status",
|
|
||||||
"check_interval",
|
|
||||||
"type",
|
|
||||||
"method",
|
|
||||||
"post_data",
|
|
||||||
"port",
|
|
||||||
"timeout",
|
|
||||||
"order_id"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"CreateUserrequest": {
|
|
||||||
"title": "Create UserRequest",
|
|
||||||
"example": {
|
|
||||||
"username": "admin",
|
|
||||||
"email": "info@email.com",
|
|
||||||
"password": "password123",
|
|
||||||
"admin": true
|
|
||||||
},
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"username": {
|
|
||||||
"description": "",
|
|
||||||
"example": "admin",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"email": {
|
|
||||||
"description": "",
|
|
||||||
"example": "info@email.com",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"password": {
|
|
||||||
"description": "",
|
|
||||||
"example": "password123",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"admin": {
|
|
||||||
"description": "",
|
|
||||||
"example": true,
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"username",
|
|
||||||
"email",
|
|
||||||
"password",
|
|
||||||
"admin"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"UpdateUserrequest": {
|
|
||||||
"title": "Update UserRequest",
|
|
||||||
"example": {
|
|
||||||
"username": "adminupdated",
|
|
||||||
"email": "info@email.com",
|
|
||||||
"password": "password123",
|
|
||||||
"admin": true
|
|
||||||
},
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"username": {
|
|
||||||
"description": "",
|
|
||||||
"example": "adminupdated",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"email": {
|
|
||||||
"description": "",
|
|
||||||
"example": "info@email.com",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"password": {
|
|
||||||
"description": "",
|
|
||||||
"example": "password123",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"admin": {
|
|
||||||
"description": "",
|
|
||||||
"example": true,
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"username",
|
|
||||||
"email",
|
|
||||||
"password",
|
|
||||||
"admin"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue