config

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: May 1, 2022 License: MIT Imports: 7 Imported by: 39

Documentation

Index

Constants

View Source
const (
	DBKindSqlite        = "sqlite"
	DBKindPostgres      = "postgres"
	DBKindMysql         = "mysql"
	DBKindClickhouse    = "clickhouse"
	DBKindElasticSearch = "elasticsearch"
)

Supported database kinds

Variables

This section is empty.

Functions

func Parse

func Parse(filename string, output Configurable) error

Parse -

Types

type Config

type Config struct {
	Version     string                `yaml:"version" validate:"required"`
	Database    Database              `yaml:"database" validate:"required"`
	DataSources map[string]DataSource `yaml:"datasources"`
	Contracts   map[string]Contract   `yaml:"contracts"`
	Hasura      *Hasura               `yaml:"hasura" validate:"omitempty"`
	Prometheus  *Prometheus           `yaml:"prometheus" validate:"omitempty"`
}

Config

func Load

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

Load - load default config from `filename`

func (*Config) Substitute

func (c *Config) Substitute() error

Substitute -

type Configurable

type Configurable interface {
	Substitute() error
}

Configurable -

type Contract

type Contract struct {
	Address  string `yaml:"address" validate:"required,len=36"`
	TypeName string `yaml:"typename"`
}

Contracts -

type Credentials added in v0.2.8

type Credentials struct {
	User *UserCredentials `yaml:"user,omitempty" validate:"omitempty"`
}

Credentials -

type DataSource

type DataSource struct {
	Kind        string       `yaml:"kind"`
	URL         string       `yaml:"url" validate:"required,url"`
	Credentials *Credentials `yaml:"credentials,omitempty" validate:"omitempty"`
}

DataSource -

type Database

type Database struct {
	Path       string `yaml:"path"`
	Kind       string `yaml:"kind" validate:"required,oneof=sqlite postgres mysql clickhouse elasticsearch"`
	Host       string `yaml:"host" validate:"required_with=Port User Database"`
	Port       int    `yaml:"port" validate:"required_with=Host User Database,gt=-1,lt=65535"`
	User       string `yaml:"user" validate:"required_with=Host Port Database"`
	Password   string `yaml:"password"`
	Database   string `yaml:"database" validate:"required_with=Host Port User"`
	SchemaName string `yaml:"schema_name"`
}

Database

type Hasura

type Hasura struct {
	URL                string `yaml:"url" validate:"required,url"`
	Secret             string `yaml:"admin_secret" validate:"required"`
	Source             string `yaml:"source" validate:"omitempty"`
	RowsLimit          uint64 `yaml:"select_limit" validate:"gt=0"`
	EnableAggregations bool   `yaml:"allow_aggregation"`
	AddSource          bool   `yaml:"add_source"`
	Rest               *bool  `yaml:"rest"`
}

Hasura -

func (*Hasura) SetSourceName added in v0.2.8

func (s *Hasura) SetSourceName()

type Prometheus added in v0.1.36

type Prometheus struct {
	URL string `yaml:"url" validate:"required"`
}

Prometheus -

type UserCredentials added in v0.2.8

type UserCredentials struct {
	Name     string `yaml:"name" validate:"required"`
	Password string `yaml:"password" validate:"required"`
}

UserCredentials -

Jump to

Keyboard shortcuts

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