configs

package
v0.90.33 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2020 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const SqliteFilename = "statping.db"

Variables

This section is empty.

Functions

func Connect

func Connect(configs *DbConfig, retry bool) error

Connect will attempt to connect to the sqlite, postgres, or mysql database

func ConnectConfigs

func ConnectConfigs(configs *DbConfig, retry bool) error

func CreateAdminUser

func CreateAdminUser(c *DbConfig) error

func TriggerSamples

func TriggerSamples() error

Types

type DbConfig

type DbConfig struct {
	DbConn      string `yaml:"connection" json:"connection"`
	DbHost      string `yaml:"host" json:"-"`
	DbUser      string `yaml:"user" json:"-"`
	DbPass      string `yaml:"password" json:"-"`
	DbData      string `yaml:"database" json:"-"`
	DbPort      int    `yaml:"port" json:"-"`
	ApiKey      string `yaml:"api_key" json:"-"`
	ApiSecret   string `yaml:"api_secret" json:"-"`
	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" json:"-"`
	SqlFile     string `yaml:"sqlfile,omitempty" json:"-"`
	LocalIP     string `yaml:"-" json:"-"`

	Db database.Database `yaml:"-" json:"-"`
	// contains filtered or unexported fields
}

DbConfig struct is used for the Db connection and creates the 'config.yml' file

func LoadConfigFile

func LoadConfigFile(directory string) (*DbConfig, error)

func LoadConfigForm

func LoadConfigForm(r *http.Request) (*DbConfig, error)

func LoadConfigs

func LoadConfigs() (*DbConfig, error)

func (*DbConfig) BackupAssets added in v0.90.14

func (d *DbConfig) BackupAssets() error

BackupAssets is a temporary function (to version 0.90.*) to backup your customized theme to a new folder called 'assets_backup'.

func (*DbConfig) Close

func (d *DbConfig) Close()

func (*DbConfig) ConnectionString added in v0.90.28

func (d *DbConfig) ConnectionString() string

func (*DbConfig) CreateDatabase

func (d *DbConfig) CreateDatabase() error

CreateDatabase will CREATE TABLES for each of the Statping elements

func (*DbConfig) DatabaseChanges

func (d *DbConfig) DatabaseChanges() error

func (*DbConfig) Delete

func (d *DbConfig) Delete() error

Save will initially create the config.yml file

func (*DbConfig) DropDatabase

func (d *DbConfig) DropDatabase() error

DropDatabase will DROP each table Statping created

func (*DbConfig) MigrateDatabase

func (d *DbConfig) MigrateDatabase() error

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.

func (*DbConfig) Save

func (d *DbConfig) Save(directory string) error

Save will initially create the config.yml file

func (*DbConfig) Update

func (d *DbConfig) Update() error

Migrate function

type Sampler

type Sampler interface {
	Samples() []database.DbObject
}

type SamplerFunc

type SamplerFunc func() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL