From d52e719e3c433a480126b470559c41a867bc49a2 Mon Sep 17 00:00:00 2001 From: Artem Bogomaz Date: Mon, 28 Mar 2022 11:45:35 +0700 Subject: [PATCH 1/2] :hammer: init commit --- code/go/0chain.net/blobber/config.go | 6 ++++++ code/go/0chain.net/blobbercore/config/config.go | 8 ++++++++ code/go/0chain.net/blobbercore/handler/protocol.go | 5 +++++ code/go/0chain.net/core/transaction/entity.go | 8 ++++++++ config/0chain_blobber.yaml | 7 +++++++ 5 files changed, 34 insertions(+) diff --git a/code/go/0chain.net/blobber/config.go b/code/go/0chain.net/blobber/config.go index 3afef74b2..b1802d865 100644 --- a/code/go/0chain.net/blobber/config.go +++ b/code/go/0chain.net/blobber/config.go @@ -101,5 +101,11 @@ func setupConfig() { } transaction.MinConfirmation = config.Configuration.MinConfirmation + + config.Configuration.Name = viper.GetString("name") + config.Configuration.WebsiteUrl = viper.GetString("website_url") + config.Configuration.LogoUrl = viper.GetString("logo_url") + config.Configuration.Description = viper.GetString("description") + fmt.Print(" [OK]\n") } diff --git a/code/go/0chain.net/blobbercore/config/config.go b/code/go/0chain.net/blobbercore/config/config.go index 0d12680d4..f72b890ba 100644 --- a/code/go/0chain.net/blobbercore/config/config.go +++ b/code/go/0chain.net/blobbercore/config/config.go @@ -138,6 +138,14 @@ type Config struct { MinSubmit int // MinConfirmation minial confirmation from sharders MinConfirmation int + + Name string + + LogoUrl string + + Description string + + WebsiteUrl string } /*Configuration of the system */ diff --git a/code/go/0chain.net/blobbercore/handler/protocol.go b/code/go/0chain.net/blobbercore/handler/protocol.go index 7e45ec694..8fa8889dd 100644 --- a/code/go/0chain.net/blobbercore/handler/protocol.go +++ b/code/go/0chain.net/blobbercore/handler/protocol.go @@ -89,6 +89,11 @@ func getStorageNode() (*transaction.StorageNode, error) { sn.StakePoolSettings.MaxStake = config.Configuration.MaxStake sn.StakePoolSettings.NumDelegates = config.Configuration.NumDelegates sn.StakePoolSettings.ServiceCharge = config.Configuration.ServiceCharge + + sn.Information.Name = config.Configuration.Name + sn.Information.Description = config.Configuration.Description + sn.Information.WebsiteUrl = config.Configuration.WebsiteUrl + sn.Information.LogoUrl = config.Configuration.LogoUrl return sn, nil } diff --git a/code/go/0chain.net/core/transaction/entity.go b/code/go/0chain.net/core/transaction/entity.go index fbbcbfc8c..90bd3cfd7 100644 --- a/code/go/0chain.net/core/transaction/entity.go +++ b/code/go/0chain.net/core/transaction/entity.go @@ -73,6 +73,13 @@ type StorageNodeGeolocation struct { Longitude float64 `json:"longitude"` } +type Info struct { + Name string `json:"name"` + WebsiteUrl string `json:"website_url"` + LogoUrl string `json:"logo_url"` + Description string `json:"description"` +} + type StorageNode struct { ID string `json:"id"` BaseURL string `json:"url"` @@ -81,6 +88,7 @@ type StorageNode struct { Capacity int64 `json:"capacity"` PublicKey string `json:"-"` StakePoolSettings StakePoolSettings `json:"stake_pool_settings"` + Information Info `json:"info"` } type BlobberAllocation struct { diff --git a/config/0chain_blobber.yaml b/config/0chain_blobber.yaml index 94a9b6192..6f46406d6 100755 --- a/config/0chain_blobber.yaml +++ b/config/0chain_blobber.yaml @@ -4,6 +4,13 @@ logging: level: "error" console: true # printing log to console is only supported in development mode +info: + name: my_blobber + logo_url: https://google.com + description: this is my test blobber + website_url: https://google.com + + # for testing # 500 MB - 536870912 # 1 GB - 1073741824 From c702ad45b1e5e49a2f6dca332650239ce86047fa Mon Sep 17 00:00:00 2001 From: Artem Bogomaz Date: Mon, 28 Mar 2022 18:32:39 +0700 Subject: [PATCH 2/2] :art: linting --- code/go/0chain.net/blobbercore/config/config.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/go/0chain.net/blobbercore/config/config.go b/code/go/0chain.net/blobbercore/config/config.go index f72b890ba..5f17bdb06 100644 --- a/code/go/0chain.net/blobbercore/config/config.go +++ b/code/go/0chain.net/blobbercore/config/config.go @@ -139,12 +139,13 @@ type Config struct { // MinConfirmation minial confirmation from sharders MinConfirmation int + // Name the name of blobber Name string - + // LogoUrl logo of blobber LogoUrl string - + // Description general information of blobber Description string - + // WebsiteUrl the website of blobber (if any) WebsiteUrl string }