From 69e098461d678c4eef01424b2df547ff3d08c16a Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Mon, 21 Oct 2024 16:09:14 -0400 Subject: [PATCH] Adds json tags to config data types --- src/apps/chifra/pkg/configtypes/chain_group.go | 18 +++++++++--------- src/apps/chifra/pkg/configtypes/config.go | 12 ++++++------ src/apps/chifra/pkg/configtypes/key_group.go | 8 ++++---- .../chifra/pkg/configtypes/notify_group.go | 4 ++-- .../chifra/pkg/configtypes/pinning_group.go | 6 +++--- .../chifra/pkg/configtypes/scrape_group.go | 12 ++++++------ .../chifra/pkg/configtypes/settings_group.go | 10 +++++----- .../chifra/pkg/configtypes/unchained_group.go | 4 ++-- .../chifra/pkg/configtypes/version_group.go | 2 +- 9 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/apps/chifra/pkg/configtypes/chain_group.go b/src/apps/chifra/pkg/configtypes/chain_group.go index acd2020734..6a2dba50b0 100644 --- a/src/apps/chifra/pkg/configtypes/chain_group.go +++ b/src/apps/chifra/pkg/configtypes/chain_group.go @@ -1,13 +1,13 @@ package configtypes type ChainGroup struct { - Chain string `toml:"chain,omitempty"` - ChainId string `toml:"chainId"` - IpfsGateway string `toml:"ipfsGateway,omitempty"` - KeyEndpoint string `toml:"keyEndpoint,omitempty"` - LocalExplorer string `toml:"localExplorer,omitempty"` - RemoteExplorer string `toml:"remoteExplorer,omitempty"` - RpcProvider string `toml:"rpcProvider"` - Symbol string `toml:"symbol"` - Scrape ScrapeSettings `toml:"scrape"` + Chain string `json:"chain" toml:"chain,omitempty"` + ChainId string `json:"chainId" toml:"chainId"` + IpfsGateway string `json:"ipfsGateway" toml:"ipfsGateway,omitempty"` + KeyEndpoint string `json:"keyEndpoint" toml:"keyEndpoint,omitempty"` + LocalExplorer string `json:"localExplorer" toml:"localExplorer,omitempty"` + RemoteExplorer string `json:"removeExplorer" toml:"remoteExplorer,omitempty"` + RpcProvider string `json:"rpcProvider" toml:"rpcProvider"` + Symbol string `json:"symbol" toml:"symbol"` + Scrape ScrapeSettings `json:"scrape" toml:"scrape"` } diff --git a/src/apps/chifra/pkg/configtypes/config.go b/src/apps/chifra/pkg/configtypes/config.go index a6d04cb8a0..db6851ecac 100644 --- a/src/apps/chifra/pkg/configtypes/config.go +++ b/src/apps/chifra/pkg/configtypes/config.go @@ -10,12 +10,12 @@ import ( ) type Config struct { - Version VersionGroup `toml:"version"` - Settings SettingsGroup `toml:"settings"` - Keys map[string]KeyGroup `toml:"keys"` - Pinning PinningGroup `toml:"pinning"` - Unchained UnchainedGroup `toml:"unchained,omitempty" comment:"Do not edit these values unless instructed to do so."` - Chains map[string]ChainGroup `toml:"chains"` + Version VersionGroup `json:"version" toml:"version"` + Settings SettingsGroup `json:"settings" toml:"settings"` + Keys map[string]KeyGroup `json:"keys" toml:"keys"` + Pinning PinningGroup `json:"pinning" toml:"pinning"` + Unchained UnchainedGroup `json:"unchained" toml:"unchained,omitempty" comment:"Do not edit these values unless instructed to do so."` + Chains map[string]ChainGroup `json:"chains" toml:"chains"` } // WriteFile writes the toml config file from the given struct diff --git a/src/apps/chifra/pkg/configtypes/key_group.go b/src/apps/chifra/pkg/configtypes/key_group.go index 3b27748676..3cacfeabdb 100644 --- a/src/apps/chifra/pkg/configtypes/key_group.go +++ b/src/apps/chifra/pkg/configtypes/key_group.go @@ -1,8 +1,8 @@ package configtypes type KeyGroup struct { - License string `toml:"license,omitempty"` - ApiKey string `toml:"apiKey"` - Secret string `toml:"secret,omitempty"` - Jwt string `toml:"jwt,omitempty"` + License string `json:"license" toml:"license,omitempty"` + ApiKey string `json:"apiKey" toml:"apiKey"` + Secret string `json:"secret" toml:"secret,omitempty"` + Jwt string `json:"jwt" toml:"jwt,omitempty"` } diff --git a/src/apps/chifra/pkg/configtypes/notify_group.go b/src/apps/chifra/pkg/configtypes/notify_group.go index 51f16e0246..c911d78103 100644 --- a/src/apps/chifra/pkg/configtypes/notify_group.go +++ b/src/apps/chifra/pkg/configtypes/notify_group.go @@ -1,6 +1,6 @@ package configtypes type NotifyGroup struct { - Url string `toml:"url" json:"url,omitempty"` - Author string `toml:"author" json:"author,omitempty"` + Url string `json:"url,omitempty" toml:"url"` + Author string `json:"author,omitempty" toml:"author"` } diff --git a/src/apps/chifra/pkg/configtypes/pinning_group.go b/src/apps/chifra/pkg/configtypes/pinning_group.go index 02506f733c..5669a6534e 100644 --- a/src/apps/chifra/pkg/configtypes/pinning_group.go +++ b/src/apps/chifra/pkg/configtypes/pinning_group.go @@ -1,7 +1,7 @@ package configtypes type PinningGroup struct { - GatewayUrl string `toml:"gatewayUrl" comment:"The pinning gateway to query when downloading the unchained index"` - LocalPinUrl string `toml:"localPinUrl" comment:"The local endpoint for the IPFS daemon"` - RemotePinUrl string `toml:"remotePinUrl" comment:"The remote endpoint for pinning on Pinata"` + GatewayUrl string `json:"gatewayUrl" toml:"gatewayUrl" comment:"The pinning gateway to query when downloading the unchained index"` + LocalPinUrl string `json:"localPinUrl" toml:"localPinUrl" comment:"The local endpoint for the IPFS daemon"` + RemotePinUrl string `json:"remotePinUrl" toml:"remotePinUrl" comment:"The remote endpoint for pinning on Pinata"` } diff --git a/src/apps/chifra/pkg/configtypes/scrape_group.go b/src/apps/chifra/pkg/configtypes/scrape_group.go index b5b5d331c9..5290636f46 100644 --- a/src/apps/chifra/pkg/configtypes/scrape_group.go +++ b/src/apps/chifra/pkg/configtypes/scrape_group.go @@ -3,12 +3,12 @@ package configtypes import "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" type ScrapeSettings struct { - AppsPerChunk uint64 `toml:"appsPerChunk" json:"appsPerChunk"` - SnapToGrid uint64 `toml:"snapToGrid" json:"snapToGrid"` - FirstSnap uint64 `toml:"firstSnap" json:"firstSnap"` - UnripeDist uint64 `toml:"unripeDist" json:"unripeDist"` - AllowMissing bool `toml:"allowMissing" json:"allowMissing,omitempty"` - ChannelCount uint64 `toml:"channelCount" json:"channelCount,omitempty"` + AppsPerChunk uint64 `json:"appsPerChunk" toml:"appsPerChunk"` + SnapToGrid uint64 `json:"snapToGrid" toml:"snapToGrid"` + FirstSnap uint64 `json:"firstSnap" toml:"firstSnap"` + UnripeDist uint64 `json:"unripeDist" toml:"unripeDist"` + AllowMissing bool `json:"allowMissing,omitempty" toml:"allowMissing"` + ChannelCount uint64 `json:"channelCount,omitempty" toml:"channelCount"` } func (s *ScrapeSettings) TestLog(chain string, test bool) { diff --git a/src/apps/chifra/pkg/configtypes/settings_group.go b/src/apps/chifra/pkg/configtypes/settings_group.go index 1d8b7e2f2b..e369f6285d 100644 --- a/src/apps/chifra/pkg/configtypes/settings_group.go +++ b/src/apps/chifra/pkg/configtypes/settings_group.go @@ -1,9 +1,9 @@ package configtypes type SettingsGroup struct { - CachePath string `toml:"cachePath" comment:"The location of the per chain caches"` - IndexPath string `toml:"indexPath" comment:"The location of the per chain unchained indexes"` - DefaultChain string `toml:"defaultChain" comment:"The default chain to use if none is provided"` - DefaultGateway string `toml:"defaultGateway,omitempty"` - Notify NotifyGroup `toml:"notify"` + CachePath string `json:"cachePath" toml:"cachePath" comment:"The location of the per chain caches"` + IndexPath string `json:"indexPath" toml:"indexPath" comment:"The location of the per chain unchained indexes"` + DefaultChain string `json:"defaultChain" toml:"defaultChain" comment:"The default chain to use if none is provided"` + DefaultGateway string `json:"defaultGateway" toml:"defaultGateway,omitempty"` + Notify NotifyGroup `json:"notify" toml:"notify"` } diff --git a/src/apps/chifra/pkg/configtypes/unchained_group.go b/src/apps/chifra/pkg/configtypes/unchained_group.go index d67cf0643d..d97ed9f0b1 100644 --- a/src/apps/chifra/pkg/configtypes/unchained_group.go +++ b/src/apps/chifra/pkg/configtypes/unchained_group.go @@ -1,6 +1,6 @@ package configtypes type UnchainedGroup struct { - PreferredPublisher string `toml:"preferredPublisher,omitempty" comment:"The default publisher of the index if none other is provided"` - SmartContract string `toml:"smartContract,omitempty" comment:"The address of the current version of the Unchained Index"` + PreferredPublisher string `json:"preferredPublisher" toml:"preferredPublisher,omitempty" comment:"The default publisher of the index if none other is provided"` + SmartContract string `json:"smartContract" toml:"smartContract,omitempty" comment:"The address of the current version of the Unchained Index"` } diff --git a/src/apps/chifra/pkg/configtypes/version_group.go b/src/apps/chifra/pkg/configtypes/version_group.go index 19b0df0ef6..02c514cf39 100644 --- a/src/apps/chifra/pkg/configtypes/version_group.go +++ b/src/apps/chifra/pkg/configtypes/version_group.go @@ -1,5 +1,5 @@ package configtypes type VersionGroup struct { - Current string `toml:"current" comment:"Do not edit"` + Current string `json:"current" toml:"current" comment:"Do not edit"` }