config

package
v0.0.0-...-bdd216b Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPusherInvalidSyncMode   = errors.New("Invalid sync mode in the pusher settings")
	ErrPusherConfigNotMatching = errors.New("The pusher config doesn't match with the one expected from the pusher sync mode")
	ErrNoSyncSettings          = errors.New("At least one of the simple_sync or the git settings must be set")
)

Functions

This section is empty.

Types

type CommitsAuthorConfig

type CommitsAuthorConfig struct {
	Name  string `yaml:"name"`
	Email string `yaml:"email"`
}

CommitsAuthorConfig contains the configuration (name + email address) to use when commiting to Git.

type Config

type Config struct {
	Grafana    GrafanaSettings     `yaml:"grafana"`
	SimpleSync *SimpleSyncSettings `yaml:"simple_sync,omitempty"`
	Git        *GitSettings        `yaml:"git,omitempty"`
	Pusher     *PusherSettings     `yaml:"pusher,omitempty"`
}

Config is the Go representation of the configuration file. It is filled when parsing the said file.

func Load

func Load(filename string) (cfg *Config, err error)

Load opens a given configuration file and parses it into an instance of the Config structure. Returns an error if there was an issue whith reading or parsing the file.

type GitSettings

type GitSettings struct {
	URL                 string              `yaml:"url"`
	User                string              `yaml:"user"`
	PrivateKeyPath      string              `yaml:"private_key"`
	ClonePath           string              `yaml:"clone_path"`
	CommitsAuthor       CommitsAuthorConfig `yaml:"commits_author"`
	DontPush            bool                `yaml:"dont_push"`
	DontCommit          bool                `yaml:"dont_commit"`
	VersionsFilePrefix  string              `yaml:"versions_file_prefix"`
	ApplyManagerCommits bool                `yaml:"apply_manager_commits"`
	Token               string              `yaml:"token"`
}

GitSettings contains the data required to interact with the Git repository.

type GrafanaSettings

type GrafanaSettings struct {
	BaseURL      string `yaml:"base_url"`
	APIKey       string `yaml:"api_key"`
	Username     string `yaml:"username"`
	Password     string `"yaml:password"`
	IgnorePrefix string `yaml:"ignore_prefix,omitempty"`
	SkipVerify   bool   `default:"false" yaml:"insecureSkipVerify"`
}

GrafanaSettings contains the data required to talk to the Grafana HTTP API.

type PusherConfig

type PusherConfig struct {
	Interface string `yaml:"interface,omitempty"`
	Port      string `yaml:"port,omitempty"`
	Path      string `yaml:"path,omitempty"`
	Secret    string `yaml:"secret,omitempty"`
	Interval  int64  `yaml:"interval,omitempty"`
}

PusherConfig contains the data required to setup either the GitLab webhook or the poller. When using the GitLab webhook, we declare the port as a string because, although it's a number, it's only used in a string concatenation when creating the webhook.

type PusherSettings

type PusherSettings struct {
	Mode   string       `yaml:"sync_mode"`
	Config PusherConfig `yaml:"config"`
}

PusherSettings contains the settings to configure the Git->Grafana pusher.

type SimpleSyncSettings

type SimpleSyncSettings struct {
	SyncPath string `yaml:"sync_path"`
}

SimpleSyncSettings contains minimal data on the synchronisation process. It is expected to be found if there is no Git settings. If both simple sync settings and Git settings are found, the Git settings will be used.

Jump to

Keyboard shortcuts

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