mirror of https://github.com/statping/statping
				
				
				
			
							parent
							
								
									706aa7a4a3
								
							
						
					
					
						commit
						676ae77fad
					
				| 
						 | 
				
			
			@ -1,5 +1,6 @@
 | 
			
		|||
# 0.90.30 (04-19-2020)
 | 
			
		||||
- Attempt to fix Github Actions build process
 | 
			
		||||
- Fix for empty database connection string, and not starting in setup mode
 | 
			
		||||
 | 
			
		||||
# 0.90.29 (04-19-2020)
 | 
			
		||||
- Added HTTP Redirects for services
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,7 @@ import (
 | 
			
		|||
 | 
			
		||||
func indexHandler(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
	if !core.App.Setup {
 | 
			
		||||
		http.Redirect(w, r, "/setup", http.StatusSeeOther)
 | 
			
		||||
		ExecuteResponse(w, r, "base.gohtml", core.App, "setup")
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	ExecuteResponse(w, r, "base.gohtml", core.App, nil)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -56,11 +56,10 @@ func LoadConfigFile(directory string) (*DbConfig, error) {
 | 
			
		|||
		Location:    utils.Directory,
 | 
			
		||||
		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")
 | 
			
		||||
 | 
			
		||||
	if configs.DbConn == "" {
 | 
			
		||||
		return configs, errors.New("Starting in setup mode")
 | 
			
		||||
	}
 | 
			
		||||
	return configs, nil
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,6 +30,14 @@ func LoadConfigForm(r *http.Request) (*DbConfig, error) {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	p := utils.Params
 | 
			
		||||
	p.Set("DB_CONN", dbConn)
 | 
			
		||||
	p.Set("DB_HOST", dbHost)
 | 
			
		||||
	p.Set("DB_USER", dbUser)
 | 
			
		||||
	p.Set("DB_PORT", dbPort)
 | 
			
		||||
	p.Set("DB_PASS", dbPass)
 | 
			
		||||
	p.Set("DB_DATABASE", dbDatabase)
 | 
			
		||||
	p.Set("NAME", project)
 | 
			
		||||
	p.Set("DESCRIPTION", description)
 | 
			
		||||
 | 
			
		||||
	confg := &DbConfig{
 | 
			
		||||
		DbConn:      dbConn,
 | 
			
		||||
| 
						 | 
				
			
			@ -47,15 +55,6 @@ func LoadConfigForm(r *http.Request) (*DbConfig, error) {
 | 
			
		|||
		Location:    utils.Directory,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	p.Set("DB_CONN", dbConn)
 | 
			
		||||
	p.Set("DB_HOST", dbHost)
 | 
			
		||||
	p.Set("DB_USER", dbUser)
 | 
			
		||||
	p.Set("DB_PORT", dbPort)
 | 
			
		||||
	p.Set("DB_PASS", dbPass)
 | 
			
		||||
	p.Set("DB_DATABASE", dbDatabase)
 | 
			
		||||
	p.Set("NAME", project)
 | 
			
		||||
	p.Set("DESCRIPTION", description)
 | 
			
		||||
 | 
			
		||||
	return confg, nil
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,7 @@ import "github.com/statping/statping/utils"
 | 
			
		|||
 | 
			
		||||
// Save will initially create the config.yml file
 | 
			
		||||
func (d *DbConfig) Save(directory string) error {
 | 
			
		||||
	if err := utils.Params.SafeWriteConfigAs(directory + "/config.yml"); err != nil {
 | 
			
		||||
	if err := utils.Params.WriteConfigAs(directory + "/config.yml"); err != nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,6 +41,7 @@ func setDefaults() {
 | 
			
		|||
	Directory = Params.GetString("STATPING_DIR")
 | 
			
		||||
	Params.SetDefault("STATPING_DIR", Directory)
 | 
			
		||||
	Params.SetDefault("GO_ENV", "")
 | 
			
		||||
	Params.SetDefault("DB_CONN", "")
 | 
			
		||||
	Params.SetDefault("DISABLE_LOGS", false)
 | 
			
		||||
	Params.SetDefault("USE_ASSETS", false)
 | 
			
		||||
	Params.SetDefault("BASE_PATH", "")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue