Add blockchain config to Config struct
This commit is contained in:
parent
155fe7bc71
commit
1759ecbc8f
@ -14,11 +14,12 @@ type Config struct {
|
|||||||
Rendezvous string `mapstructure:"rendezvous"`
|
Rendezvous string `mapstructure:"rendezvous"`
|
||||||
Ethereum EthereumConfig `mapstructure:"ethereum"`
|
Ethereum EthereumConfig `mapstructure:"ethereum"`
|
||||||
Filecoin FilecoinConfig `mapstructure:"filecoin"`
|
Filecoin FilecoinConfig `mapstructure:"filecoin"`
|
||||||
PubSub PubSubConfig `mapstructure:"pubSub"`
|
PubSub PubSubConfig `mapstructure:"pubsub"`
|
||||||
Store StoreConfig `mapstructure:"store"`
|
Store StoreConfig `mapstructure:"store"`
|
||||||
ConsensusMinApprovals int `mapstructure:"consensus_min_approvals"`
|
ConsensusMinApprovals int `mapstructure:"consensus_min_approvals"`
|
||||||
Redis RedisConfig `mapstructure:"redis"`
|
Redis RedisConfig `mapstructure:"redis"`
|
||||||
CacheType string `mapstructure:"cache_type"`
|
CacheType string `mapstructure:"cache_type"`
|
||||||
|
Blockchain BlockchainConfig `mapstructure:"blockchain"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type EthereumConfig struct {
|
type EthereumConfig struct {
|
||||||
@ -39,8 +40,7 @@ type FilecoinConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PubSubConfig struct {
|
type PubSubConfig struct {
|
||||||
ProtocolID string `mapstructure:"protocolID"`
|
ServiceTopicName string `mapstructure:"service_topic_name"`
|
||||||
ServiceTopicName string `mapstructure:"serviceTopicName"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type StoreConfig struct {
|
type StoreConfig struct {
|
||||||
@ -53,6 +53,10 @@ type RedisConfig struct {
|
|||||||
DB int `mapstructure:"redis_db"`
|
DB int `mapstructure:"redis_db"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type BlockchainConfig struct {
|
||||||
|
DatabasePath string `mapstructure:"database_path"`
|
||||||
|
}
|
||||||
|
|
||||||
// NewConfig creates a new config based on default values or provided .env file
|
// NewConfig creates a new config based on default values or provided .env file
|
||||||
func NewConfig(configPath string) (*Config, error) {
|
func NewConfig(configPath string) (*Config, error) {
|
||||||
dbName := "dione"
|
dbName := "dione"
|
||||||
@ -64,12 +68,12 @@ func NewConfig(configPath string) (*Config, error) {
|
|||||||
ListenAddr: "localhost",
|
ListenAddr: "localhost",
|
||||||
ListenPort: 8000,
|
ListenPort: 8000,
|
||||||
BootstrapNodes: []string{"/ip4/127.0.0.1/tcp/0"},
|
BootstrapNodes: []string{"/ip4/127.0.0.1/tcp/0"},
|
||||||
Rendezvous: "filecoin-p2p-oracle",
|
Rendezvous: "dione",
|
||||||
Ethereum: EthereumConfig{
|
Ethereum: EthereumConfig{
|
||||||
PrivateKey: "",
|
PrivateKey: "",
|
||||||
},
|
},
|
||||||
PubSub: PubSubConfig{
|
PubSub: PubSubConfig{
|
||||||
ProtocolID: "p2p-oracle",
|
ServiceTopicName: "dione",
|
||||||
},
|
},
|
||||||
Store: StoreConfig{
|
Store: StoreConfig{
|
||||||
DatabaseURL: dbURL,
|
DatabaseURL: dbURL,
|
||||||
|
Loading…
Reference in New Issue
Block a user