config

package
v3.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockChainNetworkFileName  = "resources/blockchain_network_config.json"
	EthereumJsonRpcEndpointKey = "ethereum_json_rpc_endpoint"
	NetworkId                  = "network_id"
	RegistryAddressKey         = "registry_address_key"
)
View Source
const (
	//Contains the Authentication address that will be used to validate all requests to update Daemon configuration remotely through a user interface
	AuthenticationAddress     = "authentication_address"
	AutoSSLDomainKey          = "auto_ssl_domain"
	AutoSSLCacheDirKey        = "auto_ssl_cache_dir"
	BlockchainEnabledKey      = "blockchain_enabled"
	BlockChainNetworkSelected = "blockchain_network_selected"
	BurstSize                 = "burst_size"
	ConfigPathKey             = "config_path"

	DaemonGroupName                = "daemon_group_name"
	DaemonTypeKey                  = "daemon_type"
	DaemonEndPoint                 = "daemon_end_point"
	ExecutablePathKey              = "executable_path"
	IpfsEndPoint                   = "ipfs_end_point"
	IpfsTimeout                    = "ipfs_timeout"
	LogKey                         = "log"
	MaxMessageSizeInMB             = "max_message_size_in_mb"
	MeteringEnabled                = "metering_enabled"
	OrganizationId                 = "organization_id"
	ServiceId                      = "service_id"
	PassthroughEnabledKey          = "passthrough_enabled"
	PassthroughEndpointKey         = "passthrough_endpoint"
	RateLimitPerMinute             = "rate_limit_per_minute"
	SSLCertPathKey                 = "ssl_cert"
	SSLKeyPathKey                  = "ssl_key"
	PaymentChannelCertPath         = "payment_channel_cert_path"
	PaymentChannelCaPath           = "payment_channel_ca_path"
	PaymentChannelKeyPath          = "payment_channel_key_path"
	PaymentChannelStorageTypeKey   = "payment_channel_storage_type"
	PaymentChannelStorageClientKey = "payment_channel_storage_client"
	PaymentChannelStorageServerKey = "payment_channel_storage_server"
	//configs for Daemon Monitoring and Notification
	AlertsEMail                 = "alerts_email"
	HeartbeatServiceEndpoint    = "heartbeat_svc_end_point"
	MeteringEndPoint            = "metering_end_point"
	PvtKeyForMetering           = "pvt_key_for_metering"
	NotificationServiceEndpoint = "notification_svc_end_point"
	ServiceHeartbeatType        = "service_heartbeat_type"
)
View Source
const DefaultDaemonConfigurationSchema = `` /* 1646-byte string literal not displayed */

Variables

This section is empty.

Functions

func CheckVersionOfDaemon added in v1.0.0

func CheckVersionOfDaemon() (message string, err error)

This function is called to see if the current daemon is on the latest version , if it is not, indicate this to the user when the daemon starts.

func ConvertStructToJSON added in v1.1.0

func ConvertStructToJSON(payLoad interface{}) ([]byte, error)

ConvertStructToJSON converts the passed datastructure to a JSON

func GetBigInt added in v0.1.2

func GetBigInt(key string) *big.Int

func GetBigIntFromViper added in v0.1.2

func GetBigIntFromViper(config *viper.Viper, key string) (value *big.Int, err error)

func GetBlockChainEndPoint added in v1.0.0

func GetBlockChainEndPoint() string

Get the block chain end point associated with the Network selected

func GetBool

func GetBool(key string) bool

func GetBuildTime added in v0.1.9

func GetBuildTime() string

func GetDuration

func GetDuration(key string) time.Duration

func GetInt

func GetInt(key string) int

func GetLatestDaemonVersion added in v1.0.0

func GetLatestDaemonVersion() (version string, err error)

func GetNetworkId added in v1.0.0

func GetNetworkId() string

Get the Network ID associated with the network selected

func GetRegistryAddress added in v1.0.0

func GetRegistryAddress() string

Get the Registry address of the contract

func GetSha1Revision added in v0.1.9

func GetSha1Revision() string

func GetString

func GetString(key string) string

func GetVersionTag added in v0.1.9

func GetVersionTag() string

func IsValidUrl added in v0.1.5

func IsValidUrl(urlToTest string) bool

isValidUrl tests a string to determine if it is a url or not.

func LoadConfig added in v0.1.2

func LoadConfig(configFile string) error

func LogConfig added in v0.1.2

func LogConfig()

func ReadConfigFromJsonString added in v0.1.2

func ReadConfigFromJsonString(config *viper.Viper, json string) error

ReadConfigFromJsonString function reads settigs from json string to the config instance. String should contain valid JSON config.

func ReadFromFile added in v1.0.0

func ReadFromFile(filename string) ([]byte, error)

Read the file given file, if the file is not found ,then return back an error

func SetDefaultFromConfig added in v0.1.2

func SetDefaultFromConfig(config *viper.Viper, defaults *viper.Viper)

SetDefaultFromConfig sets all settings from defaults as default values to the config.

func SubWithDefault added in v0.1.2

func SubWithDefault(config *viper.Viper, key string) *viper.Viper

SubWithDefault returns sub-config by keys including configuration defaults values. It returns nil if no such key. It is analog of the viper.Sub() function. This is workaround for the issue https://github.com/spf13/viper/issues/559

func Validate

func Validate() error

func ValidateEmail added in v0.1.5

func ValidateEmail(email string) bool

validates in input URL

func ValidateEndpoints added in v0.1.10

func ValidateEndpoints(daemonEndpoint string, passthroughEndpoint string) error

func Vip

func Vip() *viper.Viper

func WriteConfig added in v0.1.2

func WriteConfig(configFile string) error

Types

type ConfigurationDetails added in v1.1.0

type ConfigurationDetails struct {
	Name          string //the key of the attribute becomes the Value of the Name
	Mandatory     bool   `json:"mandatory"`
	DefaultValue  string `json:"value"`
	Description   string `json:"description"`
	Type          string `json:"type"`
	Editable      bool   `json:"editable"`
	RestartDaemon bool   `json:"restart_daemon"`
	Section       string `json:"section"`
}

Used to map the attribute values to a struct

func GetConfigurationSchema added in v1.1.0

func GetConfigurationSchema() ([]ConfigurationDetails, error)

type GitTags added in v1.0.0

type GitTags struct {
	Tag_name string `json:"tag_name"`
}

type NetworkSelected added in v1.0.0

type NetworkSelected struct {
	NetworkName             string
	EthereumJSONRPCEndpoint string
	NetworkId               string
	RegistryAddressKey      string
}

Jump to

Keyboard shortcuts

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