config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: Apache-2.0 Imports: 33 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 {
	ElasticSearch `json:"elasticSearch"`
	HTTP          `json:"http"`
	Logging       `json:"logging"`
	Nats          `json:"nats"`
	EAD           `json:"ead"`
	DB            `json:"db"`
	ImageProxy    `json:"imageProxy"`
	NameSpace     `json:"nameSpace"`
	PostHooks     []PostHook `json:"posthooks"`

	Organization `json:"organization"`
	Org          map[string]domain.OrganizationConfig `json:"org"`
	Harvest      `json:"harvest"`
	OAIPMH       `json:"oaipmh"`
	NDE          `json:"nde"`
	RDF          `json:"rdf"`
	Sitemap      `json:"sitemap"`
	// contains filtered or unexported fields
}

func (*Config) GetIndexService

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

func (*Config) Options

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

type DB

type DB struct {
	DSN          string `json:"dsn"`
	MaxOpenConns int    `json:"maxOpenConns"`
	MaxIdleConns int    `json:"maxIdleConns"`
	MaxIdleTime  string `json:"maxIdleTime"`
	AutoMigrate  bool   `json:"autoMigrate"`
	// 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"`
	Workers                 int    `json:"workers"`
	ProcessDigital          bool   `json:"processDigital"`
	ProcessDigitalIfMissing bool   `json:"processDigitalIfMissing"`
}

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
	// if non-empty digital objects will be indexed in a dedicated v2 index
	DigitalObjectSuffix 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 `json:"fastHTTP"`
	// OrphanWait is the duration in seconds that the orphanDelete will wait for the cluster to be in sync
	OrphanWait int

	// UserName is the BasicAuth username
	UserName string `json:"userName"`
	// Password is the BasicAuth password
	Password string `json:"password"`
	// contains filtered or unexported fields
}

func (*ElasticSearch) AddOptions

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

func (*ElasticSearch) CreateDefaultMappings

func (e *ElasticSearch) CreateDefaultMappings(esClient *es.Client, orgs []domain.OrganizationConfig, withAlias, withReset bool) ([]string, error)

func (*ElasticSearch) IndexService

func (e *ElasticSearch) IndexService(cfg *Config, ncfg *index.NatsConfig) (*index.Service, error)

func (*ElasticSearch) NewBulkIndexer

func (e *ElasticSearch) NewBulkIndexer(orgs *organization.Service) (*esutil.BulkIndexer, error)

func (*ElasticSearch) NewCustomClient added in v0.3.0

func (e *ElasticSearch) NewCustomClient(l *logger.CustomLogger) (*es.Client, error)

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 Harvest added in v0.3.0

type Harvest struct {
	Enabled        bool     `json:"enabled"`
	AdminEmails    []string `json:"adminEmails"`
	RepositoryName string   `json:"repositoryName"`
	HarvestDelay   int      `json:"harvestDelay"`
	EadHarvestURL  string   `json:"eadHarvestUrl"`
	MetsHarvestURL string   `json:"metsHarvestUrl"`
	HarvestPath    string   `json:"harvestPath"`
	// contains filtered or unexported fields
}

func (*Harvest) AddOptions added in v0.3.0

func (h *Harvest) AddOptions(cfg *Config) error

func (*Harvest) NewService added in v0.3.0

func (h *Harvest) NewService(cfg *Config) (*harvest.Service, error)

type ImageProxy

type ImageProxy struct {
	Enabled          bool
	CacheDir         string
	MaxSizeCacheDir  int
	ProxyPrefix      string
	Timeout          int
	ProxyReferrer    []string
	RefuseList       []string
	AllowList        []string
	AllowPorts       []string
	AllowedMimeTypes []string
	LruCacheSize     int
	EnableResize     bool
	DefaultImagePath string
}

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"`
	ErrorFieldName string   `json:"errorFieldName"`
	SentryDSN      string   `json:"sentryDSN"`
	Exclude404Path []string `json:"exclude404Path"`
}

func (*Logging) AddOptions

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

func (*Logging) GetConfig

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

type NDE added in v0.2.1

type NDE struct {
	Enabled          bool     `json:"enabled"`
	Description      string   `json:"description"`
	Name             string   `json:"name"`
	DefaultLanguages []string `json:"defaultLanguages"`
	DefaultLicense   string   `json:"defaultLicense"`
	Publisher        struct {
		Name    string `json:"name"`
		AltName string `json:"altName"`
		URL     string `json:"url"`
	} `json:"publisher"`
	DatasetFmt   string                `json:"datasetFmt"`
	Distribution []nde.DistributionCfg `json:"distribution"`
}

func (*NDE) AddOptions added in v0.2.1

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

func (*NDE) NewService added in v0.2.1

func (n *NDE) NewService(cfg *Config) (*nde.Service, error)

type NameSpace added in v0.2.1

type NameSpace struct{}

func (NameSpace) AddOptions added in v0.2.1

func (ns NameSpace) AddOptions(cfg *Config) error

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 OAIPMH added in v0.2.0

type OAIPMH struct {
	// contains filtered or unexported fields
}

func (*OAIPMH) AddOptions added in v0.2.0

func (o *OAIPMH) AddOptions(cfg *Config) error

func (*OAIPMH) NewService added in v0.2.0

func (o *OAIPMH) NewService(cfg *Config) (*oaipmh.Service, error)

type Option added in v0.2.0

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

type Organization added in v0.2.0

type Organization struct {
	// domain is a list of all valid domains (including subdomains) for an domain.Organization
	// the domain ID will be injected in each request by the organization middleware.
	Store string
}

func (*Organization) AddOptions added in v0.2.0

func (o *Organization) AddOptions(cfg *Config) error

type PostHook added in v0.1.10

type PostHook struct {
	Name        string   `json:"name"`
	ExcludeSpec []string `json:"excludeSpec"`
	URL         string   `json:"url"`
	OrgID       string   `json:"orgID"`
	APIKey      string   `json:"apiKey"`
	UserName    string   `json:"userName"`
	Password    string   `json:"password"`
	CustomWait  int      `json:"customWait"`
}

type RDF added in v0.2.1

type RDF struct {
	BaseURL string `json:"baseURL"`
}

type Sitemap added in v0.3.0

type Sitemap struct{}

func (*Sitemap) AddOptions added in v0.3.0

func (s *Sitemap) AddOptions(cfg *Config) error

func (*Sitemap) NewService added in v0.3.0

func (s *Sitemap) NewService(cfg *Config) (*sitemap.Service, error)

Jump to

Keyboard shortcuts

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