Documentation ¶
Index ¶
- Constants
- Variables
- func CheckVersionOfDaemon() (message string, err error)
- func ConvertStructToJSON(payLoad interface{}) ([]byte, error)
- func GetBigInt(key string) *big.Int
- func GetBigIntFromViper(config *viper.Viper, key string) (value *big.Int, err error)
- func GetBlockChainEndPoint() string
- func GetBool(key string) bool
- func GetBuildTime() string
- func GetDuration(key string) time.Duration
- func GetInt(key string) int
- func GetLatestDaemonVersion() (version string, err error)
- func GetNetworkId() string
- func GetRegistryAddress() string
- func GetSha1Revision() string
- func GetString(key string) string
- func GetVersionTag() string
- func IsAllowedUser(address *common.Address) bool
- func IsValidUrl(urlToTest string) bool
- func LoadConfig(configFile string) error
- func LogConfig()
- func ReadConfigFromJsonString(config *viper.Viper, json string) error
- func ReadFromFile(filename string) ([]byte, error)
- func SetAllowedUsers() (err error)
- func SetDefaultFromConfig(config *viper.Viper, defaults *viper.Viper)
- func SubWithDefault(config *viper.Viper, key string) *viper.Viper
- func Validate() error
- func ValidateEmail(email string) bool
- func ValidateEndpoints(daemonEndpoint string, passthroughEndpoint string) error
- func Vip() *viper.Viper
- func WriteConfig(configFile string) error
- type ConfigurationDetails
- type GitTags
- type NetworkSelected
Constants ¶
const ( BlockChainNetworkFileName = "resources/blockchain_network_config.json" EthereumJsonRpcEndpointKey = "ethereum_json_rpc_endpoint" NetworkId = "network_id" RegistryAddressKey = "registry_address_key" )
const ( AllowedUserFlag = "allowed_user_flag" AllowedUserAddresses = "allowed_user_addresses" AuthenticationAddresses = "authentication_addresses" 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" TokenExpiryInMinutes = "token_expiry_in_minutes" TokenSecretKey = "token_secret_key" )
const DefaultDaemonConfigurationSchema = `` /* 1646-byte string literal not displayed */
Variables ¶
var DisplayKeys = map[string]bool{ strings.ToUpper(AllowedUserFlag): true, strings.ToUpper(AllowedUserAddresses): true, strings.ToUpper(AuthenticationAddresses): true, strings.ToUpper(AutoSSLDomainKey): true, strings.ToUpper(AutoSSLCacheDirKey): true, strings.ToUpper(BlockchainEnabledKey): true, strings.ToUpper(BlockChainNetworkSelected): true, strings.ToUpper(BurstSize): true, strings.ToUpper(ConfigPathKey): true, strings.ToUpper(DaemonGroupName): true, strings.ToUpper(DaemonTypeKey): true, strings.ToUpper(DaemonEndPoint): true, strings.ToUpper(ExecutablePathKey): true, strings.ToUpper(IpfsEndPoint): true, strings.ToUpper(IpfsTimeout): true, strings.ToUpper(LogKey): true, strings.ToUpper(MaxMessageSizeInMB): true, strings.ToUpper(MeteringEnabled): true, strings.ToUpper(OrganizationId): true, strings.ToUpper(ServiceId): true, strings.ToUpper(PassthroughEnabledKey): true, strings.ToUpper(PassthroughEndpointKey): true, strings.ToUpper(RateLimitPerMinute): true, strings.ToUpper(SSLCertPathKey): true, strings.ToUpper(SSLKeyPathKey): true, strings.ToUpper(PaymentChannelCertPath): true, strings.ToUpper(PaymentChannelCaPath): true, strings.ToUpper(PaymentChannelKeyPath): true, strings.ToUpper(PaymentChannelStorageTypeKey): true, strings.ToUpper(PaymentChannelStorageClientKey): true, strings.ToUpper(PaymentChannelStorageServerKey): true, strings.ToUpper(AlertsEMail): true, strings.ToUpper(HeartbeatServiceEndpoint): true, strings.ToUpper(MeteringEndPoint): true, strings.ToUpper(NotificationServiceEndpoint): true, strings.ToUpper(ServiceHeartbeatType): true, }
Functions ¶
func CheckVersionOfDaemon ¶ added in v1.0.0
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
ConvertStructToJSON converts the passed datastructure to a JSON
func GetBigIntFromViper ¶ added in v0.1.2
func GetBlockChainEndPoint ¶ added in v1.0.0
func GetBlockChainEndPoint() string
Get the block chain end point associated with the Network selected
func GetBuildTime ¶ added in v0.1.9
func GetBuildTime() string
func GetDuration ¶
func GetLatestDaemonVersion ¶ added in v1.0.0
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 GetVersionTag ¶ added in v0.1.9
func GetVersionTag() string
func IsAllowedUser ¶
func IsValidUrl ¶ added in v0.1.5
isValidUrl tests a string to determine if it is a url or not.
func LoadConfig ¶ added in v0.1.2
func ReadConfigFromJsonString ¶ added in v0.1.2
ReadConfigFromJsonString function reads settigs from json string to the config instance. String should contain valid JSON config.
func ReadFromFile ¶ added in v1.0.0
Read the file given file, if the file is not found ,then return back an error
func SetDefaultFromConfig ¶ added in v0.1.2
SetDefaultFromConfig sets all settings from defaults as default values to the config.
func SubWithDefault ¶ added in v0.1.2
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 ValidateEndpoints ¶ added in v0.1.10
func WriteConfig ¶ added in v0.1.2
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)