Documentation ¶
Index ¶
- Constants
- func Connect(configs *DbConfig, retry bool) error
- func ConnectConfigs(configs *DbConfig, retry bool) error
- func CreateAdminUser() error
- func Save() error
- func TriggerSamples() error
- type DbConfig
- func (d *DbConfig) BackupAssets() error
- func (d *DbConfig) Clean() *DbConfig
- func (d *DbConfig) Close()
- func (d *DbConfig) ConnectionString() string
- func (d *DbConfig) CreateDatabase() error
- func (d *DbConfig) DatabaseChanges() error
- func (d *DbConfig) DropDatabase() error
- func (d *DbConfig) Merge(newCfg *DbConfig) *DbConfig
- func (d *DbConfig) MigrateDatabase() error
- func (d *DbConfig) ResetCore() error
- func (d *DbConfig) Save(directory string) error
- func (d *DbConfig) ToYAML() []byte
- func (d *DbConfig) Update() error
- type Sampler
- type SamplerFunc
Constants ¶
const SqliteFilename = "statping.db"
Variables ¶
This section is empty.
Functions ¶
func ConnectConfigs ¶
ConnectConfigs will connect to the database and save the config.yml file
func CreateAdminUser ¶
func CreateAdminUser() error
CreateAdminUser will create the default admin user "admin", "admin", or use the environment variables ADMIN_USER, ADMIN_PASSWORD, and ADMIN_EMAIL if set.
func TriggerSamples ¶
func TriggerSamples() error
Types ¶
type DbConfig ¶
type DbConfig struct { DbConn string `yaml:"connection,omitempty" json:"connection"` DbHost string `yaml:"host,omitempty" json:"-"` DbUser string `yaml:"user,omitempty" json:"-"` DbPass string `yaml:"password,omitempty" json:"-"` DbData string `yaml:"database,omitempty" json:"-"` DbPort int `yaml:"port,omitempty" json:"-"` ApiSecret string `yaml:"api_secret,omitempty" json:"-"` Language string `yaml:"language,omitempty" json:"language"` AllowReports bool `yaml:"allow_reports,omitempty" json:"allow_reports"` Project string `yaml:"-" json:"-"` Description string `yaml:"-" json:"-"` Domain string `yaml:"-" json:"-"` Username string `yaml:"-" json:"-"` Password string `yaml:"-" json:"-"` Email string `yaml:"-" json:"-"` Error error `yaml:"-" json:"-"` Location string `yaml:"location,omitempty" json:"-"` SqlFile string `yaml:"sqlfile,omitempty" json:"-"` LetsEncryptHost string `yaml:"letsencrypt_host,omitempty" json:"letsencrypt_host"` LetsEncryptEmail string `yaml:"letsencrypt_email,omitempty" json:"letsencrypt_email"` LetsEncryptEnable bool `yaml:"letsencrypt_enable,omitempty" json:"letsencrypt_enable"` LocalIP string `yaml:"-" json:"-"` DisableHTTP bool `yaml:"disable_http" json:"disable_http"` DemoMode bool `yaml:"demo_mode" json:"demo_mode"` DisableLogs bool `yaml:"disable_logs" json:"disable_logs"` UseAssets bool `yaml:"use_assets" json:"use_assets"` BasePath string `yaml:"base_path,omitempty" json:"base_path"` AdminUser string `yaml:"admin_user,omitempty" json:"admin_user"` AdminPassword string `yaml:"admin_password,omitempty" json:"admin_password"` AdminEmail string `yaml:"admin_email,omitempty" json:"admin_email"` MaxOpenConnections int `yaml:"db_open_connections,omitempty" json:"db_open_connections"` MaxIdleConnections int `yaml:"db_idle_connections,omitempty" json:"db_idle_connections"` MaxLifeConnections int `yaml:"db_max_life_connections,omitempty" json:"db_max_life_connections"` SampleData bool `yaml:"sample_data" json:"sample_data"` UseCDN bool `yaml:"use_cdn" json:"use_cdn"` DisableColors bool `yaml:"disable_colors" json:"disable_colors"` PostgresSSLMode string `yaml:"postgres_ssl,omitempty" json:"postgres_ssl"` Db database.Database `yaml:"-" json:"-"` }
DbConfig struct is used for the Db connection and creates the 'config.yml' file
func LoadConfigs ¶
func (*DbConfig) BackupAssets ¶ added in v0.90.14
BackupAssets is a temporary function (to version 0.90.*) to backup your customized theme to a new folder called 'assets_backup'.
func (*DbConfig) Clean ¶ added in v0.90.69
Clean hides all sensitive database information for API requests
func (*DbConfig) ConnectionString ¶ added in v0.90.28
func (*DbConfig) CreateDatabase ¶
CreateDatabase will CREATE TABLES for each of the Statping elements
func (*DbConfig) DatabaseChanges ¶
func (*DbConfig) DropDatabase ¶
DropDatabase will DROP each table Statping created
func (*DbConfig) Merge ¶ added in v0.90.69
Merge will merge the database connection info into the input
func (*DbConfig) MigrateDatabase ¶
MigrateDatabase will migrate the database structure to current version. This function will NOT remove previous records, tables or columns from the database. If this function has an issue, it will ROLLBACK to the previous state.
type SamplerFunc ¶
type SamplerFunc func() error