diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml
index 987e5a86..2b620e21 100644
--- a/.github/workflows/master.yml
+++ b/.github/workflows/master.yml
@@ -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
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ddeee371..a77b6c84 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/Makefile b/Makefile
index 139a40f8..e6b8ba29 100644
--- a/Makefile
+++ b/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 &
diff --git a/cmd/cli.go b/cmd/cli.go
index 38daa13f..508aad49 100644
--- a/cmd/cli.go
+++ b/cmd/cli.go
@@ -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")
diff --git a/frontend/src/forms/Service.vue b/frontend/src/forms/Service.vue
index 2d9652e6..1dfb926c 100644
--- a/frontend/src/forms/Service.vue
+++ b/frontend/src/forms/Service.vue
@@ -135,6 +135,16 @@
+
+
@@ -220,6 +230,7 @@
permalink: "",
order: 1,
verify_ssl: true,
+ redirect: true,
allow_notifications: true,
notify_all_changes: true,
notify_after: 2,
diff --git a/source/source.go b/source/source.go
index b84856dd..3a8fcb0c 100644
--- a/source/source.go
+++ b/source/source.go
@@ -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)
diff --git a/types/configs/configs_env.go b/types/configs/configs_env.go
index 3ddfe2c5..f7527414 100644
--- a/types/configs/configs_env.go
+++ b/types/configs/configs_env.go
@@ -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)
diff --git a/types/configs/file.go b/types/configs/file.go
index 53a24b53..ed44173e 100644
--- a/types/configs/file.go
+++ b/types/configs/file.go
@@ -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
}
diff --git a/types/services/routine.go b/types/services/routine.go
index 7842d685..871e7484 100644
--- a/types/services/routine.go
+++ b/types/services/routine.go
@@ -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 {
diff --git a/types/services/samples.go b/types/services/samples.go
index 5ebd573c..7d82ab9f 100644
--- a/types/services/samples.go
+++ b/types/services/samples.go
@@ -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,
}
diff --git a/types/services/struct.go b/types/services/struct.go
index 852b61e0..522eebc0 100644
--- a/types/services/struct.go
+++ b/types/services/struct.go
@@ -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"`
diff --git a/utils/configs.go b/utils/configs.go
index b3bfc5ba..bf318bd5 100644
--- a/utils/configs.go
+++ b/utils/configs.go
@@ -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)
diff --git a/utils/utils.go b/utils/utils.go
index d44acaf7..8d623682 100644
--- a/utils/utils.go
+++ b/utils/utils.go
@@ -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
diff --git a/version.txt b/version.txt
index adcbed07..f142f168 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-0.90.28
+0.90.29