config

package
v1.0.0-alpha3 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2018 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromFile

func FromFile(name string, opts ...Option) core.ConfigProvider

FromFile reads from named config file

func FromRaw

func FromRaw(configBytes []byte, configType string, opts ...Option) core.ConfigProvider

FromRaw will initialize the configs from a byte array

func FromReader

func FromReader(in io.Reader, configType string, opts ...Option) core.ConfigProvider

FromReader loads configuration from in. configType can be "json" or "yaml".

func NetworkPeerConfigFromURL

func NetworkPeerConfigFromURL(cfg core.Config, url string) (*core.NetworkPeer, error)

NetworkPeerConfigFromURL fetches the peer configuration based on a URL.

func SubstPathVars

func SubstPathVars(path string) string

SubstPathVars replaces instances of '${VARNAME}' (eg ${GOPATH}) with the variable. As a special case, $GOPATH is also replaced. NOTE: this function currently only performs substitution when the path string starts with $

as the path variables are intended to assist with testing.

Types

type Config

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

Config represents the configuration for the client

func (*Config) CAClientCertPath

func (c *Config) CAClientCertPath(org string) (string, error)

CAClientCertPath Read configuration option for the fabric CA client cert file

func (*Config) CAClientCertPem

func (c *Config) CAClientCertPem(org string) (string, error)

CAClientCertPem Read configuration option for the fabric CA client cert pem embedded in the client config

func (*Config) CAClientKeyPath

func (c *Config) CAClientKeyPath(org string) (string, error)

CAClientKeyPath Read configuration option for the fabric CA client key file

func (*Config) CAClientKeyPem

func (c *Config) CAClientKeyPem(org string) (string, error)

CAClientKeyPem Read configuration option for the fabric CA client key pem embedded in the client config

func (*Config) CAConfig

func (c *Config) CAConfig(org string) (*core.CAConfig, error)

CAConfig returns the CA configuration.

func (*Config) CAKeyStorePath

func (c *Config) CAKeyStorePath() string

CAKeyStorePath returns the same path as KeyStorePath() without the 'keystore' directory added. This is done because the fabric-ca-client adds this to the path

func (*Config) CAServerCertPaths

func (c *Config) CAServerCertPaths(org string) ([]string, error)

CAServerCertPaths Read configuration option for the server certificates will send a list of cert file paths

func (*Config) CAServerCertPems

func (c *Config) CAServerCertPems(org string) ([]string, error)

CAServerCertPems Read configuration option for the server certificates will send a list of cert pem contents directly from the config bytes array

func (*Config) ChannelConfig

func (c *Config) ChannelConfig(name string) (*core.ChannelConfig, error)

ChannelConfig returns the channel configuration

func (*Config) ChannelOrderers

func (c *Config) ChannelOrderers(name string) ([]core.OrdererConfig, error)

ChannelOrderers returns a list of channel orderers

func (*Config) ChannelPeers

func (c *Config) ChannelPeers(name string) ([]core.ChannelPeer, error)

ChannelPeers returns the channel peers configuration

func (*Config) Client

func (c *Config) Client() (*core.ClientConfig, error)

Client returns the Client config

func (*Config) CredentialStorePath

func (c *Config) CredentialStorePath() string

CredentialStorePath returns the user store path

func (*Config) CryptoConfigPath

func (c *Config) CryptoConfigPath() string

CryptoConfigPath ...

func (*Config) Ephemeral

func (c *Config) Ephemeral() bool

Ephemeral flag

func (*Config) EventServiceType

func (c *Config) EventServiceType() core.EventServiceType

EventServiceType returns the type of event service client to use

func (*Config) IsSecurityEnabled

func (c *Config) IsSecurityEnabled() bool

IsSecurityEnabled ...

func (*Config) KeyStorePath

func (c *Config) KeyStorePath() string

KeyStorePath returns the keystore path used by BCCSP

func (*Config) MSPID

func (c *Config) MSPID(org string) (string, error)

MSPID returns the MSP ID for the requested organization

func (*Config) NetworkConfig

func (c *Config) NetworkConfig() (*core.NetworkConfig, error)

NetworkConfig returns the network configuration defined in the config file

func (*Config) NetworkPeers

func (c *Config) NetworkPeers() ([]core.NetworkPeer, error)

NetworkPeers returns the network peers configuration

func (*Config) OrdererConfig

func (c *Config) OrdererConfig(name string) (*core.OrdererConfig, error)

OrdererConfig returns the requested orderer

func (*Config) OrderersConfig

func (c *Config) OrderersConfig() ([]core.OrdererConfig, error)

OrderersConfig returns a list of defined orderers

func (*Config) PeerConfig

func (c *Config) PeerConfig(org string, name string) (*core.PeerConfig, error)

PeerConfig Retrieves a specific peer from the configuration by org and name

func (*Config) PeerConfigByURL

func (c *Config) PeerConfigByURL(url string) (*core.PeerConfig, error)

PeerConfigByURL retrieves PeerConfig by URL

func (*Config) PeerMSPID

func (c *Config) PeerMSPID(name string) (string, error)

PeerMSPID returns msp that peer belongs to

func (*Config) PeersConfig

func (c *Config) PeersConfig(org string) ([]core.PeerConfig, error)

PeersConfig Retrieves the fabric peers for the specified org from the config file provided

func (*Config) RandomOrdererConfig

func (c *Config) RandomOrdererConfig() (*core.OrdererConfig, error)

RandomOrdererConfig returns a pseudo-random orderer from the network config

func (*Config) SecurityAlgorithm

func (c *Config) SecurityAlgorithm() string

SecurityAlgorithm ...

func (*Config) SecurityLevel

func (c *Config) SecurityLevel() int

SecurityLevel ...

func (*Config) SecurityProvider

func (c *Config) SecurityProvider() string

SecurityProvider provider SW or PKCS11

func (*Config) SecurityProviderLabel

func (c *Config) SecurityProviderLabel() string

SecurityProviderLabel will be set only if provider is PKCS11

func (*Config) SecurityProviderLibPath

func (c *Config) SecurityProviderLibPath() string

SecurityProviderLibPath will be set only if provider is PKCS11

func (*Config) SecurityProviderPin

func (c *Config) SecurityProviderPin() string

SecurityProviderPin will be set only if provider is PKCS11

func (*Config) SoftVerify

func (c *Config) SoftVerify() bool

SoftVerify flag

func (*Config) TLSCACertPool

func (c *Config) TLSCACertPool(certs ...*x509.Certificate) (*x509.CertPool, error)

TLSCACertPool returns the configured cert pool. If a certConfig is provided, the certficate is added to the pool

func (*Config) TLSClientCerts

func (c *Config) TLSClientCerts() ([]tls.Certificate, error)

TLSClientCerts loads the client's certs for mutual TLS It checks the config for embedded pem files before looking for cert files

func (*Config) Timeout

func (c *Config) Timeout(tType core.TimeoutType) time.Duration

Timeout reads timeouts for the given timeout type, the default is 0 if type is not found in config

func (*Config) TimeoutOrDefault

func (c *Config) TimeoutOrDefault(tType core.TimeoutType) time.Duration

TimeoutOrDefault reads timeouts for the given timeout type, if not found, defaultTimeout is returned

type Option

type Option func(opts *options) error

Option configures the package.

func WithEnvPrefix

func WithEnvPrefix(prefix string) Option

WithEnvPrefix defines the prefix for environment variable overrides. See viper SetEnvPrefix for more information.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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