From 87a76f715bafe9e66a07dbd1335b90f577693c70 Mon Sep 17 00:00:00 2001 From: hunterlong Date: Sun, 19 Apr 2020 05:53:23 -0700 Subject: [PATCH] http redirection option, issue #502, #499 --- CHANGELOG.md | 3 ++- Dockerfile | 2 +- cmd/main.go | 1 + types/configs/configs_env.go | 5 +++++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a77b6c84..f3e4e16d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ - 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 +- Modified port flag in Docker image +- Fixed issue on startup without config.yml file not starting in setup mode # 0.90.28 (04-16-2020) - Fixed postgres timestamp grouping @@ -15,7 +17,6 @@ - Added 'reset' command that will delete files and backup .db file for a fresh install - Added error type that has common errors with http status code based on error - # 0.90.27 (04-15-2020) - Fixed postgres database table creation process - Modified go build process, additional ARCHs diff --git a/Dockerfile b/Dockerfile index aba56d78..a754bd94 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,5 +18,5 @@ EXPOSE $PORT HEALTHCHECK --interval=60s --timeout=10s --retries=3 CMD curl -s "http://localhost:$PORT/health" | jq -r -e ".online==true" -CMD statping -port $PORT +CMD statping --port $PORT diff --git a/cmd/main.go b/cmd/main.go index 0fa12318..f578f957 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -86,6 +86,7 @@ func start() { confgs, err = configs.LoadConfigs() if err != nil { + log.Infoln("Starting in Setup Mode") if err := SetupMode(); err != nil { exit(err) } diff --git a/types/configs/configs_env.go b/types/configs/configs_env.go index f7527414..a4eaa48a 100644 --- a/types/configs/configs_env.go +++ b/types/configs/configs_env.go @@ -2,6 +2,7 @@ package configs import ( "fmt" + "github.com/statping/statping/types/errors" "github.com/statping/statping/utils" ) @@ -56,6 +57,10 @@ func LoadConfigFile(directory string) (*DbConfig, error) { SqlFile: p.GetString("SQL_FILE"), } + if !utils.FileExists(directory + "/config.yml") { + return nil, errors.New(fmt.Sprintf("%s/config.yml does not exist", directory)) + } + log.WithFields(utils.ToFields(configs)).Debugln("read config file: " + directory + "/config.yml") return configs, nil }