diff --git a/Makefile b/Makefile index 182a2bb0..cc91eaa4 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,10 @@ frontend-build: # build and push the images to docker hub docker: docker-build-all docker-publish-all +push-vue: + docker build -t hunterlong/statping:vue . + docker push hunterlong/statping:vue + # test all versions of Statping, golang testing and then cypress UI testing test-all: dev-deps test diff --git a/cmd/cli.go b/cmd/cli.go index eac39534..602eca8e 100644 --- a/cmd/cli.go +++ b/cmd/cli.go @@ -182,12 +182,14 @@ func ExportIndexHTML() []byte { } func updateDisplay() error { - var err error - var gitCurrent githubResponse - if gitCurrent, err = checkGithubUpdates(); err != nil { + gitCurrent, err := checkGithubUpdates() + if err != nil { fmt.Printf("Issue connecting to https://github.com/hunterlong/statping\n%v\n", err) return err } + if gitCurrent.TagName == "" { + return nil + } if len(gitCurrent.TagName) < 2 { return nil } diff --git a/cmd/main.go b/cmd/main.go index 8644d351..b07f6cb4 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -87,7 +87,7 @@ func main() { log.Info(fmt.Sprintf("Starting Statping v%v", VERSION)) updateDisplay() - _, err = core.LoadConfigFile(utils.Directory) + config, err := core.LoadConfigFile(utils.Directory) if err != nil { log.Errorln(err) core.CoreApp.Setup = false @@ -102,6 +102,9 @@ func main() { log.Fatalln(err) } } + + core.CoreApp.Config = config.DbConfig + if err := mainProcess(); err != nil { log.Fatalln(err) os.Exit(2) diff --git a/core/configs.go b/core/configs.go index 34c85c7b..203f8a63 100644 --- a/core/configs.go +++ b/core/configs.go @@ -22,7 +22,6 @@ import ( "github.com/hunterlong/statping/database" "github.com/hunterlong/statping/types" "github.com/hunterlong/statping/utils" - "io/ioutil" ) // ErrorResponse is used for HTTP errors to show to User @@ -41,12 +40,12 @@ func LoadConfigFile(directory string) (*DbConfig, error) { return LoadUsingEnv() } log.Debugln("Attempting to read config file at: " + directory + "/config.yml") - file, err := ioutil.ReadFile(directory + "/config.yml") + file, err := utils.OpenFile(directory + "/config.yml") if err != nil { CoreApp.Setup = false return nil, errors.New("config.yml file not found at " + directory + "/config.yml - starting in setup mode") } - err = yaml.Unmarshal(file, &configs) + err = yaml.Unmarshal([]byte(file), &configs) if err != nil { return nil, err }