mirror of https://github.com/statping/statping
parent
615577a00b
commit
5cd3e90b43
|
@ -137,7 +137,7 @@ jobs:
|
|||
# parallel: false
|
||||
|
||||
- name: Go Tests
|
||||
run: SASS=`which sass` go test -v -covermode=count -coverprofile=coverage.out -p=1 ./...
|
||||
run: go test -v -covermode=count -coverprofile=coverage.out -p=1 ./...
|
||||
env:
|
||||
VERSION: ${{ env.VERSION }}
|
||||
DB_CONN: sqlite3
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
# 0.90.29 (04-19-2020)
|
||||
- Added HTTP Redirects for services
|
||||
- Removed use of SASS environment variable, now finds path or sends error
|
||||
- Modified Makefile to create new snapcraft versions
|
||||
- Fixed issue when logs are not initiated yet. Issue #502
|
||||
- Fixed issue when SQLite (statping.db) is not found Issue #499
|
||||
|
||||
# 0.90.28 (04-16-2020)
|
||||
- Fixed postgres timestamp grouping
|
||||
- Added postman (newman) API testing
|
||||
|
|
21
Makefile
21
Makefile
|
@ -39,8 +39,7 @@ release: test-deps
|
|||
make build-all
|
||||
|
||||
test-ci: clean compile test-deps
|
||||
DB_CONN=sqlite SASS=`which sass` \
|
||||
go test -v -covermode=count -coverprofile=coverage.out -p=1 ./...
|
||||
DB_CONN=sqlite go test -v -covermode=count -coverprofile=coverage.out -p=1 ./...
|
||||
goveralls -coverprofile=coverage.out -service=travis-ci -repotoken ${COVERALLS}
|
||||
|
||||
cypress: clean
|
||||
|
@ -153,7 +152,7 @@ generate:
|
|||
cd source && go generate
|
||||
|
||||
build-bin:
|
||||
mkdir build
|
||||
mkdir build || true
|
||||
export PWD=`pwd`
|
||||
@for arch in $(ARCHS);\
|
||||
do \
|
||||
|
@ -202,7 +201,7 @@ clean:
|
|||
find . -name "*.out" -type f -delete
|
||||
find . -name "*.cpu" -type f -delete
|
||||
find . -name "*.mem" -type f -delete
|
||||
rm -rf {build,releases,tmp,source/build}
|
||||
rm -rf {build,releases,tmp,source/build,snap}
|
||||
|
||||
print_details:
|
||||
@echo \==== Statping Development Instance ====
|
||||
|
@ -278,19 +277,21 @@ sentry-release:
|
|||
sentry-cli releases finalize v${VERSION}
|
||||
|
||||
snapcraft: clean compile build-bin
|
||||
mkdir snap
|
||||
mv snapcraft.yaml snap/
|
||||
PWD=$(shell pwd)
|
||||
snapcraft clean statping -s pull
|
||||
snapcraft clean statping
|
||||
docker run --rm -v ${PWD}/build/statping-linux-amd64.tar.gz:/build/statping-linux.tar.gz -w /build --env VERSION=${VERSION} snapcore/snapcraft bash -c "apt update && snapcraft --target-arch=amd64"
|
||||
snapcraft clean statping -s pull
|
||||
snapcraft clean statping
|
||||
docker run --rm -v ${PWD}/build/statping-linux-386.tar.gz:/build/statping-linux.tar.gz -w /build --env VERSION=${VERSION} snapcore/snapcraft bash -c "apt update && snapcraft --target-arch=i386"
|
||||
snapcraft clean statping -s pull
|
||||
snapcraft clean statping
|
||||
docker run --rm -v ${PWD}/build/statping-linux-arm64.tar.gz:/build/statping-linux.tar.gz -w /build --env VERSION=${VERSION} snapcore/snapcraft bash -c "apt update && snapcraft --target-arch=arm64"
|
||||
snapcraft clean statping -s pull
|
||||
docker run --rm -v ${PWD}/build/statping-linux-arm.tar.gz:/build/statping-linux.tar.gz -w /build --env VERSION=${VERSION} snapcore/snapcraft bash -c "apt update && snapcraft --target-arch=armhf"
|
||||
snapcraft clean statping
|
||||
docker run --rm -v ${PWD}/build/statping-linux-arm.tar.gz:/build/statping-linux.tar.gz -w /build --env VERSION=${VERSION} snapcore/snapcraft bash -c "apt update && snapcraft --target-arch=arm"
|
||||
snapcraft push statping_${VERSION}_amd64.snap --release stable
|
||||
snapcraft push statping_${VERSION}_arm64.snap --release stable
|
||||
snapcraft push statping_${VERSION}_i386.snap --release stable
|
||||
snapcraft push statping_${VERSION}_armhf.snap --release stable
|
||||
snapcraft push statping_${VERSION}_arm.snap --release stable
|
||||
|
||||
postman: clean
|
||||
API_SECRET=demosecret123 statping --port=8080 > /dev/null &
|
||||
|
|
|
@ -323,7 +323,6 @@ func HelpEcho() {
|
|||
fmt.Println(" DOMAIN - Set a URL for the Statping status page")
|
||||
fmt.Println(" ADMIN_USER - Username for administrator account (default: admin)")
|
||||
fmt.Println(" ADMIN_PASS - Password for administrator account (default: admin)")
|
||||
fmt.Println(" SASS - Set the absolute path to the sass binary location")
|
||||
fmt.Println(" USE_ASSETS - Automatically use assets from 'assets folder' (true/false)")
|
||||
fmt.Println(" HTTP_PROXY - Use a HTTP Proxy for HTTP Requests")
|
||||
fmt.Println(" AUTH_USERNAME - HTTP Basic Authentication username")
|
||||
|
|
|
@ -135,6 +135,16 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="service.type.match(/^(http)$/)" class="form-group row">
|
||||
<label class="col-sm-4 col-form-label">Follow HTTP Redirects</label>
|
||||
<div class="col-8 mt-1">
|
||||
<span @click="service.redirect = !!service.redirect" class="switch float-left">
|
||||
<input v-model="service.redirect" type="checkbox" name="redirect-option" class="switch" id="switch-redirect" v-bind:checked="service.redirect">
|
||||
<label for="switch-redirect">Follow HTTP Redirects if server attempts</label>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="service.type.match(/^(http)$/)" class="form-group row">
|
||||
<label class="col-sm-4 col-form-label">Verify SSL</label>
|
||||
<div class="col-8 mt-1">
|
||||
|
@ -220,6 +230,7 @@
|
|||
permalink: "",
|
||||
order: 1,
|
||||
verify_ssl: true,
|
||||
redirect: true,
|
||||
allow_notifications: true,
|
||||
notify_all_changes: true,
|
||||
notify_after: 2,
|
||||
|
|
|
@ -43,13 +43,10 @@ func scssRendered(name string) string {
|
|||
|
||||
// CompileSASS will attempt to compile the SASS files into CSS
|
||||
func CompileSASS(files ...string) error {
|
||||
sassBin := utils.Params.GetString("SASS")
|
||||
|
||||
path, err := exec.LookPath("sass")
|
||||
sassBin, err := exec.LookPath("sass")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sassBin = path
|
||||
|
||||
for _, file := range files {
|
||||
scssFile := fmt.Sprintf("%v/assets/%v", utils.Params.GetString("STATPING_DIR"), file)
|
||||
|
|
|
@ -10,21 +10,19 @@ func (d *DbConfig) ConnectionString() string {
|
|||
postgresSSL := utils.Params.GetString("POSTGRES_SSLMODE")
|
||||
|
||||
switch d.DbConn {
|
||||
case "sqlite", "sqlite3", "memory":
|
||||
if d.DbConn == "memory" {
|
||||
conn = "sqlite3"
|
||||
d.DbConn = ":memory:"
|
||||
return d.DbConn
|
||||
} else {
|
||||
conn, err := findDbFile(d)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
}
|
||||
d.SqlFile = conn
|
||||
log.Infof("SQL database file at: %s", d.SqlFile)
|
||||
d.DbConn = "sqlite3"
|
||||
return d.SqlFile
|
||||
case "memory", ":memory:":
|
||||
conn = "sqlite3"
|
||||
d.DbConn = ":memory:"
|
||||
return d.DbConn
|
||||
case "sqlite", "sqlite3":
|
||||
conn, err := findDbFile(d)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
}
|
||||
d.SqlFile = conn
|
||||
log.Infof("SQL database file at: %s", d.SqlFile)
|
||||
d.DbConn = "sqlite3"
|
||||
return d.SqlFile
|
||||
case "mysql":
|
||||
host := fmt.Sprintf("%v:%v", d.DbHost, d.DbPort)
|
||||
conn = fmt.Sprintf("%v:%v@tcp(%v)/%v?charset=utf8&parseTime=True&loc=UTC&time_zone=%%27UTC%%27", d.DbUser, d.DbPass, host, d.DbData)
|
||||
|
|
|
@ -38,7 +38,8 @@ func findDbFile(configs *DbConfig) (string, error) {
|
|||
if configs == nil {
|
||||
file, err := findSQLin(utils.Directory)
|
||||
if err != nil {
|
||||
return "", err
|
||||
log.Errorln(err)
|
||||
return location, nil
|
||||
}
|
||||
location = file
|
||||
}
|
||||
|
|
|
@ -234,6 +234,10 @@ func CheckHttp(s *Service, record bool) *Service {
|
|||
headers = nil
|
||||
}
|
||||
|
||||
if s.Redirect.Bool {
|
||||
headers = append(headers, "Redirect=true")
|
||||
}
|
||||
|
||||
if s.PostData.String != "" {
|
||||
data = bytes.NewBuffer([]byte(s.PostData.String))
|
||||
} else {
|
||||
|
|
|
@ -21,6 +21,7 @@ func Samples() error {
|
|||
Public: null.NewNullBool(true),
|
||||
Permalink: null.NewNullString("google"),
|
||||
VerifySSL: null.NewNullBool(true),
|
||||
Redirect: null.NewNullBool(true),
|
||||
NotifyAfter: 3,
|
||||
CreatedAt: createdOn,
|
||||
}
|
||||
|
@ -79,6 +80,7 @@ func Samples() error {
|
|||
Order: 4,
|
||||
Public: null.NewNullBool(true),
|
||||
VerifySSL: null.NewNullBool(true),
|
||||
Redirect: null.NewNullBool(true),
|
||||
GroupId: 2,
|
||||
NotifyAfter: 3,
|
||||
CreatedAt: createdOn,
|
||||
|
@ -111,6 +113,7 @@ func Samples() error {
|
|||
Timeout: 120,
|
||||
Order: 6,
|
||||
Public: null.NewNullBool(false),
|
||||
Redirect: null.NewNullBool(true),
|
||||
GroupId: 3,
|
||||
CreatedAt: createdOn,
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ type Service struct {
|
|||
GroupId int `gorm:"default:0;column:group_id" json:"group_id"`
|
||||
Headers null.NullString `gorm:"column:headers" json:"headers" scope:"user,admin"`
|
||||
Permalink null.NullString `gorm:"column:permalink" json:"permalink"`
|
||||
Redirect null.NullBool `gorm:"default:false;column:redirect" json:"redirect" scope:"user,admin"`
|
||||
CreatedAt time.Time `gorm:"column:created_at" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"`
|
||||
Online bool `gorm:"-" json:"online"`
|
||||
|
|
|
@ -53,7 +53,6 @@ func setDefaults() {
|
|||
Params.SetDefault("USE_CDN", false)
|
||||
Params.SetDefault("ALLOW_REPORTS", false)
|
||||
Params.SetDefault("POSTGRES_SSLMODE", "disable")
|
||||
Params.SetDefault("SASS", "sass")
|
||||
Params.SetDefault("REMOVE_AFTER", 2160*time.Hour)
|
||||
Params.SetDefault("CLEANUP_INTERVAL", 1*time.Hour)
|
||||
|
||||
|
|
|
@ -250,6 +250,13 @@ func HttpRequest(url, method string, content interface{}, headers []string, body
|
|||
Timeout: timeout,
|
||||
}
|
||||
|
||||
if req.Header.Get("Redirect") != "true" {
|
||||
client.CheckRedirect = func(req *http.Request, via []*http.Request) error {
|
||||
return http.ErrUseLastResponse
|
||||
}
|
||||
req.Header.Del("Redirect")
|
||||
}
|
||||
|
||||
if resp, err = client.Do(req); err != nil {
|
||||
httpMetric.Errors++
|
||||
return nil, resp, err
|
||||
|
|
|
@ -1 +1 @@
|
|||
0.90.28
|
||||
0.90.29
|
||||
|
|
Loading…
Reference in New Issue