config

package
v0.0.0-...-93e01a0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// APIDefaultFilterLimit is the default limit that will be applied to filtered queries on the API
	APIDefaultFilterLimit = rootKey("api.defaultFilterLimit")
	// APIMaxFilterLimit is the maximum limit that can be specified by an API call
	APIMaxFilterLimit = rootKey("api.maxFilterLimit")
	// APIMaxFilterSkip is the maximum skip value that can be specified on the API
	APIMaxFilterSkip = rootKey("api.maxFilterLimit")
	// APIRequestTimeout is the server side timeout for API calls (context timeout), to avoid the server continuing processing when the client gives up
	APIRequestTimeout = rootKey("api.requestTimeout")
	// APIRequestMaxTimeout is the maximum timeout an application can set using a Request-Timeout header
	APIRequestMaxTimeout = rootKey("api.requestMaxTimeout")
	// BatchManagerReadPageSize is the size of each page of messages read from the database into memory when assembling batches
	BatchManagerReadPageSize = rootKey("batch.manager.readPageSize")
	// BatchManagerReadPollTimeout is how long without any notifications of new messages to wait, before doing a page query
	BatchManagerReadPollTimeout = rootKey("batch.manager.pollTimeout")
	// BatchRetryFactor is the retry backoff factor for database operations performed by the batch manager
	BatchRetryFactor = rootKey("batch.retry.factor")
	// BatchRetryInitDelay is the retry initial delay for database operations
	BatchRetryInitDelay = rootKey("batch.retry.initDelay")
	// BatchRetryMaxDelay is the maximum delay between retry attempts
	BatchRetryMaxDelay = rootKey("batch.retry.maxDelay")
	// BlockchainType is the name of the blockchain interface plugin being used by this firefly node
	BlockchainType = rootKey("blockchain.type")
	// BroadcastBatchAgentTimeout how long to keep around a batching agent for a sending identity before disposal
	BroadcastBatchAgentTimeout = rootKey("broadcast.batch.agentTimeout")
	// BroadcastBatchSize is the maximum size of a batch for broadcast messages
	BroadcastBatchSize = rootKey("broadcast.batch.size")
	// BroadcastBatchTimeout is the timeout to wait for a batch to fill, before sending
	BroadcastBatchTimeout = rootKey("broadcast.batch.timeout")
	// PrivateMessagingBatchAgentTimeout how long to keep around a batching agent for a sending identity before disposal
	PrivateMessagingBatchAgentTimeout = rootKey("privatemessaging.batch.agentTimeout")
	// PrivateMessagingBatchSize is the maximum size of a batch for broadcast messages
	PrivateMessagingBatchSize = rootKey("privatemessaging.batch.size")
	// PrivateMessagingBatchTimeout is the timeout to wait for a batch to fill, before sending
	PrivateMessagingBatchTimeout = rootKey("privatemessaging.batch.timeout")
	// PrivateMessagingOpCorrelationRetries how many times to correlate an event for an operation (such as tx submission) back to an operation.
	// Needed because the operation update might come back before we are finished persisting the ID of the request
	PrivateMessagingOpCorrelationRetries = rootKey("privatemessaging.opCorrelationRetries")
	// PrivateMessagingRetryFactor the backoff factor to use for retry of database operations
	PrivateMessagingRetryFactor = rootKey("privatemessaging.retry.factor")
	// PrivateMessagingRetryInitDelay the initial delay to use for retry of data base operations
	PrivateMessagingRetryInitDelay = rootKey("privatemessaging.retry.initDelay")
	// PrivateMessagingRetryMaxDelay the maximum delay to use for retry of data base operations
	PrivateMessagingRetryMaxDelay = rootKey("privatemessaging.retry.maxDelay")
	// CorsAllowCredentials CORS setting to control whether a browser allows credentials to be sent to this API
	CorsAllowCredentials = rootKey("cors.credentials")
	// CorsAllowedHeaders CORS setting to control the allowed headers
	CorsAllowedHeaders = rootKey("cors.headers")
	// CorsAllowedMethods CORS setting to control the allowed methods
	CorsAllowedMethods = rootKey("cors.methods")
	// CorsAllowedOrigins CORS setting to control the allowed origins
	CorsAllowedOrigins = rootKey("cors.origins")
	// CorsDebug is whether debug is enabled for the CORS implementation
	CorsDebug = rootKey("cors.debug")
	// CorsEnabled is whether cors is enabled
	CorsEnabled = rootKey("cors.enabled")
	// CorsMaxAge is the maximum age a browser should rely on CORS checks
	CorsMaxAge = rootKey("cors.maxAge")
	// DataexchangeType is the name of the data exchange plugin being used by this firefly node
	DataexchangeType = rootKey("dataexchange.type")
	// DatabaseType the type of the database interface plugin to use
	DatabaseType = rootKey("database.type")
	// TokensList is the root key containing a list of supported token connectors
	TokensList = rootKey("tokens")
	// DebugPort a HTTP port on which to enable the go debugger
	DebugPort = rootKey("debug.port")
	// EventTransportsDefault the default event transport for new subscriptions
	EventTransportsDefault = rootKey("event.transports.default")
	// EventTransportsEnabled which event interface plugins are enabled
	EventTransportsEnabled = rootKey("event.transports.enabled")
	// EventAggregatorFirstEvent the first event the aggregator should process, if no previous offest is stored in the DB
	EventAggregatorFirstEvent = rootKey("event.aggregator.firstEvent")
	// EventAggregatorBatchSize the maximum number of records to read from the DB before performing an aggregation run
	EventAggregatorBatchSize = rootKey("event.aggregator.batchSize")
	// EventAggregatorBatchTimeout how long to wait for new events to arrive before performing aggregation on a page of events
	EventAggregatorBatchTimeout = rootKey("event.aggregator.batchTimeout")
	// EventAggregatorOpCorrelationRetries how many times to correlate an event for an operation (such as tx submission) back to an operation.
	// Needed because the operation update might come back before we are finished persisting the ID of the request
	EventAggregatorOpCorrelationRetries = rootKey("event.aggregator.opCorrelationRetries")
	// EventAggregatorPollTimeout the time to wait without a notification of new events, before trying a select on the table
	EventAggregatorPollTimeout = rootKey("event.aggregator.pollTimeout")
	// EventAggregatorRetryFactor the backoff factor to use for retry of database operations
	EventAggregatorRetryFactor = rootKey("event.aggregator.retry.factor")
	// EventAggregatorRetryInitDelay the initial delay to use for retry of data base operations
	EventAggregatorRetryInitDelay = rootKey("event.aggregator.retry.initDelay")
	// EventAggregatorRetryMaxDelay the maximum delay to use for retry of data base operations
	EventAggregatorRetryMaxDelay = rootKey("event.aggregator.retry.maxDelay")
	// EventDispatcherPollTimeout the time to wait without a notification of new events, before trying a select on the table
	EventDispatcherPollTimeout = rootKey("event.dispatcher.pollTimeout")
	// EventDispatcherBufferLength the number of events + attachments an individual dispatcher should hold in memory ready for delivery to the subscription
	EventDispatcherBufferLength = rootKey("event.dispatcher.bufferLength")
	// EventDispatcherBatchTimeout a short time to wait for new events to arrive before re-polling for new events
	EventDispatcherBatchTimeout = rootKey("event.dispatcher.batchTimeout")
	// EventDispatcherRetryFactor the backoff factor to use for retry of database operations
	EventDispatcherRetryFactor = rootKey("event.dispatcher.retry.factor")
	// EventDispatcherRetryInitDelay he initial delay to use for retry of data base operations
	EventDispatcherRetryInitDelay = rootKey("event.dispatcher.retry.initDelay")
	// EventDispatcherRetryMaxDelay he maximum delay to use for retry of data base operations
	EventDispatcherRetryMaxDelay = rootKey("event.dispatcher.retry.maxDelay")
	// EventDBEventsBufferSize the size of the buffer of change events
	EventDBEventsBufferSize = rootKey("event.dbevents.bufferSize")
	// GroupCacheSize cache size for private group addresses
	GroupCacheSize = rootKey("group.cache.size")
	// GroupCacheTTL cache time-to-live for private group addresses
	GroupCacheTTL = rootKey("group.cache.ttl")
	// AdminHTTPEnabled determines whether the admin interface will be enabled or not
	AdminEnabled = rootKey("admin.enabled")
	// AdminPreinit waits for at least one ConfigREcord to be posted to the server before it starts (the database must be available on startup)
	AdminPreinit = rootKey("admin.preinit")
	// IdentityType the type of the identity plugin in use
	IdentityType = rootKey("identity.type")
	// Lang is the language to use for translation
	Lang = rootKey("lang")
	// LogForceColor forces color to be enabled, even if we do not detect a TTY
	LogForceColor = rootKey("log.forceColor")
	// LogLevel is the logging level
	LogLevel = rootKey("log.level")
	// LogNoColor forces color to be disabled, even if we detect a TTY
	LogNoColor = rootKey("log.noColor")
	// LogTimeFormat is a string format for timestamps
	LogTimeFormat = rootKey("log.timeFormat")
	// LogUTC sets log timestamps to the UTC timezone
	LogUTC = rootKey("log.utc")
	// LogFilename sets logging to file
	LogFilename = rootKey("log.filename")
	// LogFilesize sets the size to roll logs at
	LogFilesize = rootKey("log.filesize")
	// LogMaxBackups sets the maximum number of old files to keep
	LogMaxBackups = rootKey("log.maxBackups")
	// LogMaxAge sets the maximum age at which to roll
	LogMaxAge = rootKey("log.maxAge")
	// LogCompress sets whether to compress backups
	LogCompress = rootKey("log.compress")
	// NamespacesDefault is the default namespace - must be in the predefines list
	NamespacesDefault = rootKey("namespaces.default")
	// NamespacesPredefined is a list of namespaces to ensure exists, without requiring a broadcast from the network
	NamespacesPredefined = rootKey("namespaces.predefined")
	// NodeName is a description for the node
	NodeName = rootKey("node.name")
	// NodeDescription is a description for the node
	NodeDescription = rootKey("node.description")
	// OrgName is the short name o the org
	OrgName = rootKey("org.name")
	// OrgIdentity is the signing identity allocated to the organization (can be the same as the nodes)
	OrgIdentity = rootKey("org.identity")
	// OrgDescription is a description for the org
	OrgDescription = rootKey("org.description")
	// OrchestratorStartupAttempts is how many time to attempt to connect to core infrastructure on startup
	OrchestratorStartupAttempts = rootKey("orchestrator.startupAttempts")
	// PublicStorageType specifies which public storage interface plugin to use
	PublicStorageType = rootKey("publicstorage.type")
	// SubscriptionDefaultsReadAhead default read ahead to enable for subscriptions that do not explicitly configure readahead
	SubscriptionDefaultsReadAhead = rootKey("subscription.defaults.batchSize")
	// SubscriptionMax maximum number of pre-defined subscriptions that can exist (note for high fan-out consider connecting a dedicated pub/sub broker to the dispatcher)
	SubscriptionMax = rootKey("subscription.max")
	// SubscriptionsRetryInitialDelay is the initial retry delay
	SubscriptionsRetryInitialDelay = rootKey("subscription.retry.initDelay")
	// SubscriptionsRetryMaxDelay is the initial retry delay
	SubscriptionsRetryMaxDelay = rootKey("subscription.retry.maxDelay")
	// SubscriptionsRetryFactor the backoff factor to use for retry of database operations
	SubscriptionsRetryFactor = rootKey("event.dispatcher.retry.factor")
	// UIEnabled set to false to disable the UI (default is true, so UI will be enabled if ui.path is valid)
	UIEnabled = rootKey("ui.enabled")
	// UIPath the path on which to serve the UI
	UIPath = rootKey("ui.path")
	// ValidatorCacheSize
	ValidatorCacheSize = rootKey("validator.cache.size")
	// ValidatorCacheTTL
	ValidatorCacheTTL = rootKey("validator.cache.ttl")
)

The following keys can be access from the root configuration. Plugins are resonsible for defining their own keys using the Config interface

Functions

func Get

func Get(key RootKey) interface{}

Get gets a configuration in raw form

func GetBool

func GetBool(key RootKey) bool

GetBool gets a configuration bool

func GetByteSize

func GetByteSize(key RootKey) int64

GetByteSize get a size in bytes

func GetConfig

func GetConfig() fftypes.JSONObject

func GetDuration

func GetDuration(key RootKey) time.Duration

GetDuration gets a configuration time duration with consistent semantics

func GetFloat64

func GetFloat64(key RootKey) float64

GetFloat64 gets a configuration uint

func GetInt

func GetInt(key RootKey) int

GetInt gets a configuration uint

func GetInt64

func GetInt64(key RootKey) int64

GetInt64 gets a configuration uint

func GetKnownKeys

func GetKnownKeys() []string

GetKnownKeys gets the known keys

func GetObject

func GetObject(key RootKey) fftypes.JSONObject

GetObject gets a configuration map

func GetObjectArray

func GetObjectArray(key RootKey) fftypes.JSONObjectArray

GetObjectArray gets an array of configuration maps

func GetString

func GetString(key RootKey) string

GetString gets a configuration string

func GetStringSlice

func GetStringSlice(key RootKey) []string

GetStringSlice gets a configuration string array

func GetUint

func GetUint(key RootKey) uint

GetUint gets a configuration uint

func MergeConfig

func MergeConfig(configRecords []*fftypes.ConfigRecord) error

func ReadConfig

func ReadConfig(cfgFile string) error

ReadConfig initializes the config

func Reset

func Reset()

func Set

func Set(key RootKey, value interface{})

Set allows runtime setting of config (used in unit tests)

func SetupLogging

func SetupLogging(ctx context.Context)

SetupLogging initializes logging

Types

type KeySet

type KeySet interface {
	AddKnownKey(key string, defValue ...interface{})
}

type Prefix

type Prefix interface {
	KeySet
	SetDefault(key string, defValue interface{})
	SubPrefix(suffix string) Prefix
	Array() PrefixArray
	Set(key string, value interface{})
	Resolve(key string) string

	GetString(key string) string
	GetBool(key string) bool
	GetInt(key string) int
	GetInt64(key string) int64
	GetByteSize(key string) int64
	GetUint(key string) uint
	GetDuration(key string) time.Duration
	GetStringSlice(key string) []string
	GetObject(key string) fftypes.JSONObject
	GetObjectArray(key string) fftypes.JSONObjectArray
	Get(key string) interface{}
}

Prefix represents the global configuration, at a nested point in the config hierarchy. This allows plugins to define their Note that all values are GLOBAL so this cannot be used for per-instance customization. Rather for global initialization of plugins.

func NewPluginConfig

func NewPluginConfig(prefix string) Prefix

NewPluginConfig creates a new plugin configuration object, at the specified prefix

type PrefixArray

type PrefixArray interface {
	KeySet
	ArraySize() int
	ArrayEntry(i int) Prefix
}

PrefixArray represents an array of options at a particular layer in the config. This allows specifying the schema of keys that exist for every entry, and the defaults, as well as querying how many entries exist and generating a prefix for each entry (so that you can iterate).

type RootKey

type RootKey string

RootKey key are the known configuration keys

Jump to

Keyboard shortcuts

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