config

package
v0.0.0-...-667e438 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TLSImplFactory func(vp *viper.Viper) TLSImpl = func(*viper.Viper) TLSImpl {
	return FailTLSImpl{dummyImply{}}
}

an impl which create util for tls's crypto elements

Functions

func CacheConfiguration

func CacheConfiguration() error

CacheConfiguration caches configuration settings so that reading the yaml file can be avoided on future requests

func CacheViper

func CacheViper(thevp ...*viper.Viper)

func DebugModule

func DebugModule(moduleName string)

func GetLocalIP

func GetLocalIP() string

GetLocalIP returns the non loopback local IP of the host TODO: this should be a singleton service (the result can be reused) and should use more way to obtain the real "external" IP for server

func GetLogger

func GetLogger(tag string) *logging.Logger

func GlobalFileSystemPath

func GlobalFileSystemPath() string

func GlobalFileSystemPathRaw

func GlobalFileSystemPathRaw() string

func InitCryptoGlobal

func InitCryptoGlobal(vp *viper.Viper) (err error)

Init initializes the crypto layer. It load from viper the security level and the logging setting.

func InitViperForEnv

func InitViperForEnv(prefix string, vp ...*viper.Viper)

func MergeViperPrefix

func MergeViperPrefix(path string, vp *viper.Viper) string

func RestoreAllModule

func RestoreAllModule()

func RestoreMoudleLogging

func RestoreMoudleLogging(moduleName string)

func SecurityEnabled

func SecurityEnabled() bool

SecurityEnabled returns true if security is enabled

func SetupTestConfig

func SetupTestConfig(pathToOpenchainYaml string)

SetupTestConfig setup the config during test execution

func SubViper

func SubViper(path string, thevp ...*viper.Viper) *viper.Viper

Types

type ClientSpec

type ClientSpec struct {
	Address string
	// contains filtered or unexported fields
}

func (*ClientSpec) GetClientTLSOptions

func (ts *ClientSpec) GetClientTLSOptions() (credentials.TransportCredentials, error)

func (*ClientSpec) GetServerTLSOptions

func (ts *ClientSpec) GetServerTLSOptions() (credentials.TransportCredentials, error)

we also make an implement to generating the grpc credential

func (*ClientSpec) Init

func (s *ClientSpec) Init(vp *viper.Viper) error

type FailTLSImpl

type FailTLSImpl struct {
	E error
}

func (FailTLSImpl) GetRootCerts

func (e FailTLSImpl) GetRootCerts() (*x509.CertPool, error)

func (FailTLSImpl) GetTLSCert

func (e FailTLSImpl) GetTLSCert() (*tls.Certificate, error)

type ServerSpec

type ServerSpec struct {
	Address      string
	ExternalAddr string
	MessageSize  int
	AutoDetect   bool
	// contains filtered or unexported fields
}

a server's specification: including the listen address, declaimed address (which a external accessor should use), TLS scheme etc...

func (*ServerSpec) GetClient

func (s *ServerSpec) GetClient() *ClientSpec

func (*ServerSpec) GetClientTLSOptions

func (ts *ServerSpec) GetClientTLSOptions() (credentials.TransportCredentials, error)

func (*ServerSpec) GetServerTLSOptions

func (ts *ServerSpec) GetServerTLSOptions() (credentials.TransportCredentials, error)

we also make an implement to generating the grpc credential

func (*ServerSpec) Init

func (s *ServerSpec) Init(vp *viper.Viper) error

Init the spec from viper

type SetupTestConf

type SetupTestConf struct {
	Prefix     string
	ConfigName string
	YamlPath   string
}

func (SetupTestConf) Setup

func (c SetupTestConf) Setup()

type TLSImpl

type TLSImpl interface {
	GetTLSCert() (*tls.Certificate, error)
	GetRootCerts() (*x509.CertPool, error)
}

Jump to

Keyboard shortcuts

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