config

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetViperDefaults

func SetViperDefaults()

Types

type Config

type Config struct {
	// default orgID when none is given
	OrgID             string `json:"orgID"`
	ElasticSearch     `json:"elasticSearch"`
	HTTP              `json:"http"`
	TimeRevisionStore `json:"timeRevisionStore"`
	Logging           `json:"logging"`
	Nats              `json:"nats"`
	EAD               `json:"ead"`
	DB                `json:"db"`
	ImageProxy        `json:"imageProxy"`
	// contains filtered or unexported fields
}

func (*Config) GetIndexService

func (cfg *Config) GetIndexService() (*index.Service, error)

func (*Config) Options

func (cfg *Config) Options(cfgOptions ...ConfigOption) ([]ikuzo.Option, error)

type ConfigOption

type ConfigOption interface {
	AddOptions(cfg *Config) error
}

type DB

type DB struct {
	// supported types are "sqlite3" "postgres"
	Type string
	// go sql compatible connection string, e.g. "/tmp/test.db" for sqlit3 or
	// "host=myhost port=myport user=hub3 dbname=hub3 password=mypassword"
	Connect string
	// contains filtered or unexported fields
}

func (*DB) AddOptions

func (db *DB) AddOptions(cfg *Config) error

func (*DB) Shutdown

func (db *DB) Shutdown(ctx context.Context) error

type EAD

type EAD struct {
	CacheDir string `json:"cacheDir"`
	Metrics  bool   `json:"metrics"`
}

func (*EAD) AddOptions

func (e *EAD) AddOptions(cfg *Config) error

func (EAD) NewService

func (e EAD) NewService(cfg *Config) (*ead.Service, error)

type ElasticSearch

type ElasticSearch struct {
	// enable elasticsearch client
	Enabled bool
	// urls to connect to elasticsearch cluster
	Urls []string
	// enable elasticsearch caching proxy
	Proxy bool
	// number of elasticsearch workers. default: 1
	Workers int
	// maxRetries number of client retries. default: 5
	MaxRetries int
	// clientTimeOut seconds for the client to time out. default 10
	ClientTimeOut int
	// gather elasticsearch metrics
	Metrics bool

	// base of the index aliases
	IndexName string
	// number of shards. default 1
	Shards int
	// number of replicas. default 0
	Replicas int

	// UseRemoteIndexer is true when a separate process reads of the queue
	UseRemoteIndexer bool
	// IndexTypes options are v1, v2, fragment
	IndexTypes []string
	// use FastHTTP transport for communication with the ElasticSearch cluster
	FastHTTP bool
	// contains filtered or unexported fields
}

func (*ElasticSearch) AddOptions

func (e *ElasticSearch) AddOptions(cfg *Config) error

func (*ElasticSearch) CreateDefaultMappings

func (e *ElasticSearch) CreateDefaultMappings(es *elasticsearch.Client, withAlias bool, withReset bool) ([]string, error)

func (*ElasticSearch) IndexService

func (e *ElasticSearch) IndexService(l *logger.CustomLogger, ncfg *index.NatsConfig) (*index.Service, error)

func (*ElasticSearch) NewBulkIndexer

func (e *ElasticSearch) NewBulkIndexer(es *elasticsearch.Client) (esutil.BulkIndexer, error)

func (*ElasticSearch) NewClient

func (e *ElasticSearch) NewClient(l *logger.CustomLogger) (*elasticsearch.Client, error)

func (*ElasticSearch) ResetAll

func (e *ElasticSearch) ResetAll(w http.ResponseWriter, r *http.Request)

type HTTP

type HTTP struct {
	Port        int    `json:"port" mapstructure:"port"`
	MetricsPort int    `json:"metricsPort"`
	CertFile    string `json:"certFile"`
	KeyFile     string `json:"keyFile"`
}

func (*HTTP) AddOptions

func (http *HTTP) AddOptions(cfg *Config) error

type ImageProxy

type ImageProxy struct {
	Enabled     bool
	CacheDir    string
	ProxyPrefix string
	Timeout     int
}

func (*ImageProxy) AddOptions

func (ip *ImageProxy) AddOptions(cfg *Config) error

type Logging

type Logging struct {
	DevMode       bool   `json:"devmode"`
	Level         string `json:"level"`
	WithCaller    bool   `json:"withCaller"`
	ConsoleLogger bool   `json:"consoleLogger"`
}

func (*Logging) AddOptions

func (l *Logging) AddOptions(cfg *Config) error

func (*Logging) GetConfig

func (l *Logging) GetConfig() logger.Config

type Nats

type Nats struct {
	Enabled      bool   `json:"enabled"`
	ClusterID    string `json:"clusterID"`
	ClientID     string `json:"clientID"`
	DurableName  string `json:"durableName"`
	DurableQueue string `json:"durableQueue"`
	URL          string `json:"url"`
	// contains filtered or unexported fields
}

Nats are configuration options to access NATS streaming server

func (*Nats) AddOptions

func (n *Nats) AddOptions(cfg *Config) error

func (*Nats) GetConfig

func (n *Nats) GetConfig() (*index.NatsConfig, error)

type TimeRevisionStore

type TimeRevisionStore struct {
	Enabled  bool   `json:"enabled"`
	DataPath string `json:"dataPath"`
}

func (*TimeRevisionStore) AddOptions

func (trs *TimeRevisionStore) AddOptions(cfg *Config) error

Jump to

Keyboard shortcuts

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