Skip to content

Commit

Permalink
Adds json tags to config data types
Browse files Browse the repository at this point in the history
  • Loading branch information
tjayrush committed Oct 21, 2024
1 parent 9cf1aac commit 69e0984
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 38 deletions.
18 changes: 9 additions & 9 deletions src/apps/chifra/pkg/configtypes/chain_group.go
Original file line number Diff line number Diff line change
@@ -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"`
}
12 changes: 6 additions & 6 deletions src/apps/chifra/pkg/configtypes/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/apps/chifra/pkg/configtypes/key_group.go
Original file line number Diff line number Diff line change
@@ -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"`
}
4 changes: 2 additions & 2 deletions src/apps/chifra/pkg/configtypes/notify_group.go
Original file line number Diff line number Diff line change
@@ -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"`
}
6 changes: 3 additions & 3 deletions src/apps/chifra/pkg/configtypes/pinning_group.go
Original file line number Diff line number Diff line change
@@ -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"`
}
12 changes: 6 additions & 6 deletions src/apps/chifra/pkg/configtypes/scrape_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 5 additions & 5 deletions src/apps/chifra/pkg/configtypes/settings_group.go
Original file line number Diff line number Diff line change
@@ -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"`
}
4 changes: 2 additions & 2 deletions src/apps/chifra/pkg/configtypes/unchained_group.go
Original file line number Diff line number Diff line change
@@ -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"`
}
2 changes: 1 addition & 1 deletion src/apps/chifra/pkg/configtypes/version_group.go
Original file line number Diff line number Diff line change
@@ -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"`
}

0 comments on commit 69e0984

Please sign in to comment.