Documentation ¶
Index ¶
- Variables
- func GenerateConfigMarkdown(ctx context.Context, keys []string) ([]byte, error)
- func Get(key RootKey) interface{}
- func GetBool(key RootKey) bool
- func GetByteSize(key RootKey) int64
- func GetConfig() fftypes.JSONObject
- func GetDuration(key RootKey) time.Duration
- func GetFloat64(key RootKey) float64
- func GetInt(key RootKey) int
- func GetInt64(key RootKey) int64
- func GetKnownKeys() []string
- func GetObject(key RootKey) fftypes.JSONObject
- func GetObjectArray(key RootKey) fftypes.JSONObjectArray
- func GetString(key RootKey) string
- func GetStringSlice(key RootKey) []string
- func GetUint(key RootKey) uint
- func MergeConfig(configRecords []*fftypes.ConfigRecord) error
- func ReadConfig(cfgSuffix, cfgFile string) error
- func RootConfigReset(setServiceDefaults ...func())
- func Set(key RootKey, value interface{})
- func SetupLogging(ctx context.Context)
- type KeySet
- type Prefix
- type PrefixArray
- type RootKey
Constants ¶
This section is empty.
Variables ¶
var ( // Lang is the language to use for translation Lang = ffc("lang") // LogForceColor forces color to be enabled, even if we do not detect a TTY LogForceColor = ffc("log.forceColor") // LogLevel is the logging level LogLevel = ffc("log.level") // LogNoColor forces color to be disabled, even if we detect a TTY LogNoColor = ffc("log.noColor") // LogTimeFormat is a string format for timestamps LogTimeFormat = ffc("log.timeFormat") // LogUTC sets log timestamps to the UTC timezone LogUTC = ffc("log.utc") // LogFilename sets logging to file LogFilename = ffc("log.filename") // LogFilesize sets the size to roll logs at LogFilesize = ffc("log.filesize") // LogMaxBackups sets the maximum number of old files to keep LogMaxBackups = ffc("log.maxBackups") // LogMaxAge sets the maximum age at which to roll LogMaxAge = ffc("log.maxAge") // LogCompress sets whether to compress backups LogCompress = ffc("log.compress") // LogIncludeCodeInfo enables the report caller for including the calling file and line number LogIncludeCodeInfo = ffc("log.includeCodeInfo") // LogJSONEnabled enables JSON formatted logs rather than text LogJSONEnabled = ffc("log.json.enabled") // LogJSONTimestampField configures the JSON key containing the timestamp of the log LogJSONTimestampField = ffc("log.json.fields.timestamp") // LogJSONLevelField configures the JSON key containing the log level LogJSONLevelField = ffc("log.json.fields.level") // LogJSONMessageField configures the JSON key containing the log message LogJSONMessageField = ffc("log.json.fields.message") // LogJSONFuncField configures the JSON key containing the calling function LogJSONFuncField = ffc("log.json.fields.func") // LogJSONFileField configures the JSON key containing the calling file LogJSONFileField = ffc("log.json.fields.file") )
The following keys can be access from the root configuration. Plugins are responsible for defining their own keys using the Config interface
Functions ¶
func GenerateConfigMarkdown ¶
func GetConfig ¶
func GetConfig() fftypes.JSONObject
func GetDuration ¶
GetDuration gets a configuration time duration with consistent semantics
func GetObjectArray ¶
func GetObjectArray(key RootKey) fftypes.JSONObjectArray
GetObjectArray gets an array of configuration maps
func GetStringSlice ¶
GetStringSlice gets a configuration string array
func MergeConfig ¶
func MergeConfig(configRecords []*fftypes.ConfigRecord) error
func ReadConfig ¶
ReadConfig initializes the config
func RootConfigReset ¶
func RootConfigReset(setServiceDefaults ...func())
Types ¶
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 ¶
NewPluginConfig creates a new plugin configuration object, at the specified prefix
type PrefixArray ¶
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).