postgres custom SSL mode - postman API update

pull/127/head
hunterlong 2019-02-04 10:37:51 -08:00
parent 337fb6b8db
commit acff0924a0
6 changed files with 237 additions and 14 deletions

View File

@ -3,13 +3,13 @@
</p>
<p align="center">
<b>Statping - Web and App Status Monitoring for Any Type of Project</b><br>
<a href="https://github.com/hunterlong/statping/wiki">View Wiki</a> | <a href="https://demo.statping.com">Demo</a> | <a href="https://itunes.apple.com/us/app/apple-store/id1445513219">iPhone</a> | <a href="https://play.google.com/store/apps/details?id=com.statping">Android</a> <br> <a href="https://github.com/hunterlong/statping/wiki/API">API</a> | <a href="https://github.com/hunterlong/statping/wiki/Docker">Docker</a> | <a href="https://github.com/hunterlong/statping/wiki/AWS-EC2">EC2</a> | <a href="https://github.com/hunterlong/statping/wiki/Heroku">Heroku</a> | <a href="https://github.com/hunterlong/statping/wiki/Mac">Mac</a> | <a href="https://github.com/hunterlong/statping/wiki/Linux">Linux</a> | <a href="https://github.com/hunterlong/statping/wiki/Windows">Windows</a> | <a href="https://github.com/hunterlong/statping/wiki/Statping-Plugins">Plugins</a>
<a href="https://github.com/hunterlong/statping/wiki">View Wiki</a> | <a href="https://demo.statping.com">Demo</a> | <a href="https://itunes.apple.com/us/app/apple-store/id1445513219">iPhone</a> | <a href="https://play.google.com/store/apps/details?id=com.statping">Android</a> <br> <a href="https://github.com/hunterlong/statping/wiki/API">API</a> | <a href="https://github.com/hunterlong/statping/wiki/Docker">Docker</a> | <a href="https://github.com/hunterlong/statping/wiki/AWS-EC2">EC2</a> | <a href="https://github.com/hunterlong/statping/wiki/Mac">Mac</a> | <a href="https://github.com/hunterlong/statping/wiki/Linux">Linux</a> | <a href="https://github.com/hunterlong/statping/wiki/Windows">Windows</a> | <a href="https://github.com/hunterlong/statping/wiki/Statping-Plugins">Plugins</a>
</p>
# Statping - Status Page & Monitoring Server
An easy to use Status Page for your websites and applications. Statping will automatically fetch the application and render a beautiful status page with tons of features for you to build an even better status page. This Status Page generator allows you to use MySQL, Postgres, or SQLite on multiple operating systems.
[![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://godoc.org/github.com/hunterlong/statping) [![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/statup-app/general) [![](https://images.microbadger.com/badges/image/hunterlong/statping.svg)](https://microbadger.com/images/hunterlong/statping)
[![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://godoc.org/github.com/hunterlong/statping) [![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/statup-app/general) [![](https://images.microbadger.com/badges/image/hunterlong/statping.svg)](https://microbadger.com/images/hunterlong/statping) [![Docker Pulls](https://img.shields.io/docker/pulls/hunterlong/statping.svg)](https://hub.docker.com/r/hunterlong/statping/builds/)
## A Future-Proof Status Page
Statping strives to remain future-proof and remain intact if a failure is created. Your Statping service should not be running on the same instance you're trying to monitor. If your server crashes your Status Page should still remaining online to notify your users of downtime.
@ -25,6 +25,16 @@ The Status binary for all other OS's is ~17Mb at most.
## No Requirements
Statping is built in Go Language so all you need is the precompile binary based on your operating system. You won't need to install anything extra once you have the Statping binary installed. You can even run Statping on a Raspberry Pi.
<p align="center">
<a href="https://github.com/hunterlong/statping/wiki/Linux"><img width="5%" src="https://img.cjx.io/linux.png"></a>
<a href="https://github.com/hunterlong/statping/wiki/Mac"><img width="5%" src="https://img.cjx.io/apple.png"></a>
<a href="https://github.com/hunterlong/statping/wiki/Windows"><img width="5%" src="https://img.cjx.io/windows.png"></a>
<a href="https://play.google.com/store/apps/details?id=com.statping"><img width="5%" src="https://img.cjx.io/android.png"></a>
<a href="https://itunes.apple.com/us/app/apple-store/id1445513219"><img width="5%" src="https://img.cjx.io/appstore.png"></a>
<a href="https://hub.docker.com/r/hunterlong/statping"><img width="5%" src="https://img.cjx.io/dockericon.png"></a>
</p>
## Mobile App is Gorgeous
The Statping app is available on the App Store and Google Play for free. The app will allow you to view services, receive notifications when a service is offline, update groups, users, services, messages, and more! Start your own Statping server and then connect it to the app by scanning the QR code in settings.

View File

@ -226,7 +226,7 @@ func HelpEcho() {
fmt.Println(" DB_PASS - Database password")
fmt.Println(" DB_PORT - Database port (5432, 3306, ...)")
fmt.Println(" DB_DATABASE - Database connection's database name")
fmt.Println(" POSTGRES_SSL - Enable Postgres SSL Mode 'ssl_mode=enabled' (true/false)")
fmt.Println(" POSTGRES_SSLMODE - Enable Postgres SSL Mode 'ssl_mode=VALUE' (enable/disable/verify-full/verify-ca)")
fmt.Println(" GO_ENV - Run Statping in testmode, will bypass HTTP authentication (if set as 'true')")
fmt.Println(" NAME - Set a name for the Statping status page")
fmt.Println(" DESCRIPTION - Set a description for the Statping status page")

View File

@ -26,7 +26,6 @@ import (
_ "github.com/jinzhu/gorm/dialects/postgres"
_ "github.com/jinzhu/gorm/dialects/sqlite"
"os"
"strconv"
"time"
)
@ -179,7 +178,7 @@ func (db *DbConfig) InsertCore() (*Core, error) {
// Connect will attempt to connect to the sqlite, postgres, or mysql database
func (db *DbConfig) Connect(retry bool, location string) error {
postgresSSL, _ := strconv.ParseBool(os.Getenv("POSTGRES_SSL"))
postgresSSL := os.Getenv("POSTGRES_SSLMODE")
if DbSession != nil {
return nil
}
@ -197,9 +196,9 @@ func (db *DbConfig) Connect(retry bool, location string) error {
host := fmt.Sprintf("%v:%v", Configs.DbHost, Configs.DbPort)
conn = fmt.Sprintf("%v:%v@tcp(%v)/%v?charset=utf8&parseTime=True&loc=UTC", Configs.DbUser, Configs.DbPass, host, Configs.DbData)
case "postgres":
sslMode := "disabled"
if postgresSSL {
sslMode = "enabled"
sslMode := "disable"
if postgresSSL != "" {
sslMode = postgresSSL
}
conn = fmt.Sprintf("host=%v port=%v user=%v dbname=%v password=%v timezone=UTC sslmode=%v", Configs.DbHost, Configs.DbPort, Configs.DbUser, Configs.DbData, Configs.DbPass, sslMode)
case "mssql":

View File

@ -2,7 +2,7 @@
"info": {
"_postman_id": "94807b85-ef65-4370-9144-b1a74e04cb0e",
"name": "Statping",
"description": "Statping API Requests",
"description": "Statup API Requests",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
@ -58,6 +58,108 @@
"description": "The root API route to view basic Statping settings."
},
"response": []
},
{
"name": "Statping Clear Cache",
"event": [
{
"listen": "test",
"script": {
"id": "08b8f487-2318-44b9-bdb8-f1f1041e9462",
"exec": [
"pm.test(\"Check Core API Route\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.name).to.eql(\"Statping\");",
" pm.expect(jsonData.description).to.eql(\"Statping Monitoring Sample Data\");",
" pm.expect(jsonData.using_cdn).to.eql(false);",
" pm.expect(jsonData.database).to.eql(\"sqlite\");",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{api_key}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{endpoint}}/api/clear_cache",
"host": [
"{{endpoint}}"
],
"path": [
"api",
"clear_cache"
]
},
"description": "The root API route to view basic Statping settings."
},
"response": []
},
{
"name": "Statping Reset API Tokens",
"event": [
{
"listen": "test",
"script": {
"id": "08b8f487-2318-44b9-bdb8-f1f1041e9462",
"exec": [
"pm.test(\"Check Core API Route\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.name).to.eql(\"Statping\");",
" pm.expect(jsonData.description).to.eql(\"Statping Monitoring Sample Data\");",
" pm.expect(jsonData.using_cdn).to.eql(false);",
" pm.expect(jsonData.database).to.eql(\"sqlite\");",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{api_key}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{endpoint}}/api/renew",
"host": [
"{{endpoint}}"
],
"path": [
"api",
"renew"
]
},
"description": "The root API route to view basic Statping settings."
},
"response": []
}
],
"auth": {
@ -335,6 +437,118 @@
}
]
},
{
"name": "View Service Ping Data",
"event": [
{
"listen": "test",
"script": {
"id": "023c5643-6cb1-4cd0-b775-566f232d68f8",
"exec": [
"pm.test(\"Service Chart Default\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.data.length).to.be.at.least(100);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{api_key}}",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{endpoint}}/api/services/1/ping",
"host": [
"{{endpoint}}"
],
"path": [
"api",
"services",
"1",
"ping"
]
}
},
"response": []
},
{
"name": "View Service Heatmap Data",
"event": [
{
"listen": "test",
"script": {
"id": "023c5643-6cb1-4cd0-b775-566f232d68f8",
"exec": [
"pm.test(\"Service Chart Default\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.data.length).to.be.at.least(100);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{api_key}}",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{endpoint}}/api/services/1/heatmap",
"host": [
"{{endpoint}}"
],
"path": [
"api",
"services",
"1",
"heatmap"
]
}
},
"response": []
},
{
"name": "View Service Failures",
"event": [
@ -1911,7 +2125,7 @@
],
"body": {
"mode": "raw",
"raw": "{\n \"method\": \"mobile\",\n \"host\": \"\",\n \"port\": 0,\n \"username\": \"\",\n \"var1\": \"ExponentPushToken[ToBadIWillError123456]\",\n \"var2\": \"\",\n \"api_key\": \"\",\n \"api_secret\": \"\",\n \"enabled\": true,\n \"limits\": 55\n}"
"raw": "{\n \"method\": \"mobile\",\n \"var1\": \"ExponentPushToken[ToBadIWillError123456]\",\n \"enabled\": true,\n \"limits\": 55\n}"
},
"url": {
"raw": "{{endpoint}}/api/notifier/mobile",
@ -2819,4 +3033,4 @@
]
}
]
}
}

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
0.80.43
0.80.44