Documentation ¶
Index ¶
- Constants
- Variables
- func CheckVersionOfDaemon() (message string, err error)
- func ConvertStructToJSON(payLoad any) ([]byte, error)
- func Get(key string) any
- func GetBigInt(key string) *big.Int
- func GetBigIntFromViper(config *viper.Viper, key string) (value *big.Int, err error)
- func GetBlockChainHTTPEndPoint() string
- func GetBlockChainWSEndPoint() string
- func GetBool(key string) bool
- func GetBuildTime() string
- func GetDuration(key string) time.Duration
- func GetFreeCallsCount(userID string) (countFreeCallsAllowed int)
- 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 GetStringMap(key string) map[string]any
- func GetStringSlice(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 NewJsonConfigFromString(config string) *viper.Viper
- 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 SetVip(newVip *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" EthereumJsonRpcHTTPEndpointKey = "ethereum_json_rpc_http_endpoint" EthereumJsonRpcWSEndpointKey = "ethereum_json_rpc_ws_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" EnableDynamicPricing = "enable_dynamic_pricing" IpfsEndPoint = "ipfs_end_point" IpfsTimeout = "ipfs_timeout" LogKey = "log" MaxMessageSizeInMB = "max_message_size_in_mb" MeteringEnabled = "metering_enabled" // ModelMaintenanceEndPoint This is for grpc server end point for Model Maintenance like Create, update, delete, status check ModelMaintenanceEndPoint = "model_maintenance_endpoint" // ModelTrainingEndpoint This is for directing any training calls on Models, as training calls are heavy on resources ModelTrainingEndpoint = "model_training_endpoint" ModelTrainingEnabled = "model_training_enabled" OrganizationId = "organization_id" ServiceId = "service_id" PassthroughEnabledKey = "passthrough_enabled" PassthroughEndpointKey = "passthrough_endpoint" ServiceCredentialsKey = "service_credentials" 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" BlockchainProviderApiKey = "blockchain_provider_api_key" FreeCallsUsers = "free_calls_users" MinimumConfigJson string = `` /* 457-byte string literal not displayed */ )
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 ¶
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 ¶
ConvertStructToJSON converts the passed datastructure to a JSON
func GetBigIntFromViper ¶
func GetBlockChainHTTPEndPoint ¶
func GetBlockChainHTTPEndPoint() string
Get the blockchain endpoint associated with the Network selected
func GetBlockChainWSEndPoint ¶
func GetBlockChainWSEndPoint() string
func GetBuildTime ¶
func GetBuildTime() string
func GetDuration ¶
func GetFreeCallsCount ¶
func GetLatestDaemonVersion ¶
func GetNetworkId ¶
func GetNetworkId() string
Get the Network ID associated with the network selected
func GetSha1Revision ¶
func GetSha1Revision() string
func GetStringMap ¶
func GetStringSlice ¶
func GetVersionTag ¶
func GetVersionTag() string
func IsAllowedUser ¶
func IsValidUrl ¶
isValidUrl tests a string to determine if it is a url or not.
func LoadConfig ¶
func NewJsonConfigFromString ¶
NewJsonConfigFromString for tests
func ReadConfigFromJsonString ¶
ReadConfigFromJsonString function reads settigs from json string to the config instance. String should contain valid JSON config.
func ReadFromFile ¶
Read the file given file, if the file is not found ,then return back an error
func SetDefaultFromConfig ¶
SetDefaultFromConfig sets all settings from defaults as default values to the config.
func SetVip ¶
SetVip allows setting a new Viper instance. This is useful for testing, where you may want to change the configuration.
func SubWithDefault ¶
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 ¶
func WriteConfig ¶
Types ¶
type ConfigurationDetails ¶
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 ¶
func GetConfigurationSchema() ([]ConfigurationDetails, error)