fabric: github.com/hyperledger/fabric/orderer/common/localconfig Index | Files

package localconfig

import "github.com/hyperledger/fabric/orderer/common/localconfig"


Package Files



const Prefix = "ORDERER"

Prefix for environment variables.


var Defaults = TopLevel{
    General: General{
        LedgerType:     "file",
        ListenAddress:  "",
        ListenPort:     7050,
        GenesisMethod:  "provisional",
        GenesisProfile: "SampleSingleMSPSolo",
        SystemChannel:  "test-system-channel-name",
        GenesisFile:    "genesisblock",
        Profile: Profile{
            Enabled: false,
            Address: "",
        Cluster: Cluster{
            ReplicationMaxRetries:                12,
            RPCTimeout:                           time.Second * 7,
            DialTimeout:                          time.Second * 5,
            ReplicationBufferSize:                20971520,
            SendBufferSize:                       10,
            ReplicationBackgroundRefreshInterval: time.Minute * 5,
            ReplicationRetryTimeout:              time.Second * 5,
            ReplicationPullTimeout:               time.Second * 5,
            CertExpirationWarningThreshold:       time.Hour * 24 * 7,
        LocalMSPDir: "msp",
        LocalMSPID:  "SampleOrg",
        BCCSP:       bccsp.GetDefaultOpts(),
        Authentication: Authentication{
            TimeWindow: time.Duration(15 * time.Minute),
    RAMLedger: RAMLedger{
        HistorySize: 10000,
    FileLedger: FileLedger{
        Location: "/var/hyperledger/production/orderer",
        Prefix:   "hyperledger-fabric-ordererledger",
    Kafka: Kafka{
        Retry: Retry{
            ShortInterval: 1 * time.Minute,
            ShortTotal:    10 * time.Minute,
            LongInterval:  10 * time.Minute,
            LongTotal:     12 * time.Hour,
            NetworkTimeouts: NetworkTimeouts{
                DialTimeout:  30 * time.Second,
                ReadTimeout:  30 * time.Second,
                WriteTimeout: 30 * time.Second,
            Metadata: Metadata{
                RetryBackoff: 250 * time.Millisecond,
                RetryMax:     3,
            Producer: Producer{
                RetryBackoff: 100 * time.Millisecond,
                RetryMax:     3,
            Consumer: Consumer{
                RetryBackoff: 2 * time.Second,
        Verbose: false,
        Version: sarama.V0_10_2_0,
        TLS: TLS{
            Enabled: false,
        Topic: Topic{
            ReplicationFactor: 3,
    Debug: Debug{
        BroadcastTraceDir: "",
        DeliverTraceDir:   "",
    Operations: Operations{
        ListenAddress: "",
    Metrics: Metrics{
        Provider: "disabled",

Defaults carries the default orderer configuration values.

type Authentication Uses

type Authentication struct {
    TimeWindow         time.Duration
    NoExpirationChecks bool

Authentication contains configuration parameters related to authenticating client messages.

type Cluster Uses

type Cluster struct {
    ListenAddress                        string
    ListenPort                           uint16
    ServerCertificate                    string
    ServerPrivateKey                     string
    ClientCertificate                    string
    ClientPrivateKey                     string
    RootCAs                              []string
    DialTimeout                          time.Duration
    RPCTimeout                           time.Duration
    ReplicationBufferSize                int
    ReplicationPullTimeout               time.Duration
    ReplicationRetryTimeout              time.Duration
    ReplicationBackgroundRefreshInterval time.Duration
    ReplicationMaxRetries                int
    SendBufferSize                       int
    CertExpirationWarningThreshold       time.Duration
    TLSHandshakeTimeShift                time.Duration

type Consumer Uses

type Consumer struct {
    RetryBackoff time.Duration

Consumer contains configuration for the consumer's retries when failing to read from a Kafa partition.

type Debug Uses

type Debug struct {
    BroadcastTraceDir string
    DeliverTraceDir   string

Debug contains configuration for the orderer's debug parameters.

type FileLedger Uses

type FileLedger struct {
    Location string
    Prefix   string

FileLedger contains configuration for the file-based ledger.

type General Uses

type General struct {
    LedgerType        string
    ListenAddress     string
    ListenPort        uint16
    TLS               TLS
    Cluster           Cluster
    Keepalive         Keepalive
    ConnectionTimeout time.Duration
    GenesisMethod     string
    GenesisProfile    string
    SystemChannel     string
    GenesisFile       string
    Profile           Profile
    LocalMSPDir       string
    LocalMSPID        string
    BCCSP             *bccsp.FactoryOpts
    Authentication    Authentication

General contains config which should be common among all orderer types.

type Kafka Uses

type Kafka struct {
    Retry     Retry
    Verbose   bool
    Version   sarama.KafkaVersion // TODO Move this to global config
    TLS       TLS
    SASLPlain SASLPlain
    Topic     Topic

Kafka contains configuration for the Kafka-based orderer.

type Keepalive Uses

type Keepalive struct {
    ServerMinInterval time.Duration
    ServerInterval    time.Duration
    ServerTimeout     time.Duration

Keepalive contains configuration for gRPC servers.

type Metadata Uses

type Metadata struct {
    RetryMax     int
    RetryBackoff time.Duration

Metadata contains configuration for the metadata requests to the Kafka cluster.

type Metrics Uses

type Metrics struct {
    Provider string
    Statsd   Statsd

Operations confiures the metrics provider for the orderer.

type NetworkTimeouts Uses

type NetworkTimeouts struct {
    DialTimeout  time.Duration
    ReadTimeout  time.Duration
    WriteTimeout time.Duration

NetworkTimeouts contains the socket timeouts for network requests to the Kafka cluster.

type Operations Uses

type Operations struct {
    ListenAddress string
    TLS           TLS

Operations configures the operations endpont for the orderer.

type Producer Uses

type Producer struct {
    RetryMax     int
    RetryBackoff time.Duration

Producer contains configuration for the producer's retries when failing to post a message to a Kafka partition.

type Profile Uses

type Profile struct {
    Enabled bool
    Address string

Profile contains configuration for Go pprof profiling.

type RAMLedger Uses

type RAMLedger struct {
    HistorySize uint

RAMLedger contains configuration for the RAM ledger.

type Retry Uses

type Retry struct {
    ShortInterval   time.Duration
    ShortTotal      time.Duration
    LongInterval    time.Duration
    LongTotal       time.Duration
    NetworkTimeouts NetworkTimeouts
    Metadata        Metadata
    Producer        Producer
    Consumer        Consumer

Retry contains configuration related to retries and timeouts when the connection to the Kafka cluster cannot be established, or when Metadata requests needs to be repeated (because the cluster is in the middle of a leader election).

type SASLPlain Uses

type SASLPlain struct {
    Enabled  bool
    User     string
    Password string

SASLPlain contains configuration for SASL/PLAIN authentication

type Statsd Uses

type Statsd struct {
    Network       string
    Address       string
    WriteInterval time.Duration
    Prefix        string

Statsd provides the configuration required to emit statsd metrics from the orderer.

type TLS Uses

type TLS struct {
    Enabled            bool
    PrivateKey         string
    Certificate        string
    RootCAs            []string
    ClientAuthRequired bool
    ClientRootCAs      []string

TLS contains configuration for TLS connections.

type TopLevel Uses

type TopLevel struct {
    General    General
    FileLedger FileLedger
    RAMLedger  RAMLedger
    Kafka      Kafka
    Debug      Debug
    Consensus  interface{}
    Operations Operations
    Metrics    Metrics

TopLevel directly corresponds to the orderer config YAML. Note, for non 1-1 mappings, you may append something like `mapstructure:"weirdFoRMat"` to modify the default mapping, see the "Unmarshal" section of https://github.com/spf13/viper for more info.

func Load Uses

func Load() (*TopLevel, error)

Load parses the orderer YAML file and environment, producing a struct suitable for config use, returning error on failure.

type Topic Uses

type Topic struct {
    ReplicationFactor int16

Topic contains the settings to use when creating Kafka topics

Package localconfig imports 10 packages (graph) and is imported by 9 packages. Updated 2019-08-09. Refresh now. Tools for package owners.