mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-16 04:24:56 +02:00
config: adding AbiCache
This commit is contained in:
parent
dccd7c0520
commit
b60436c48a
4 changed files with 26 additions and 0 deletions
|
|
@ -40,6 +40,9 @@ func NewBuilder() *Builder {
|
|||
"telegram.id": "telegram-id",
|
||||
"telegram.channel": "telegram-channel",
|
||||
|
||||
// AbiCache
|
||||
"abi_cache.api_timeout": "abi-cache-api-timeout",
|
||||
|
||||
// Log
|
||||
"log.maxfilesize": "log-max-filesize",
|
||||
"log.maxtime": "log-max-time",
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ func TestBuilder(t *testing.T) {
|
|||
MaxTime: 30 * time.Minute,
|
||||
FileTimestampFormat: "20060102@150405",
|
||||
},
|
||||
AbiCache: AbiCache{
|
||||
ApiTimeout: time.Minute * 300,
|
||||
},
|
||||
Ship: ShipConfig{
|
||||
Url: "127.0.0.1:8089",
|
||||
StartBlockNum: 23671836,
|
||||
|
|
@ -53,6 +56,8 @@ func TestBuilder(t *testing.T) {
|
|||
name: "ship-reader-1"
|
||||
api: "http://127.0.0.1:8080"
|
||||
message_codec: "mojibake"
|
||||
abi_cache:
|
||||
api_timeout: 300m
|
||||
log:
|
||||
filename: some_file.log
|
||||
directory: /path/to/whatever
|
||||
|
|
@ -96,6 +101,9 @@ func TestBuilder_WithDefaultConfig(t *testing.T) {
|
|||
MaxTime: time.Hour * 24,
|
||||
FileTimestampFormat: "2006-01-02_150405",
|
||||
},
|
||||
AbiCache: AbiCache{
|
||||
ApiTimeout: time.Second,
|
||||
},
|
||||
Ship: ShipConfig{
|
||||
Url: "ws://127.0.0.1:8080",
|
||||
StartBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
||||
|
|
@ -133,6 +141,7 @@ func TestBuilder_Flags(t *testing.T) {
|
|||
require.NoError(t, flags.Set("redis-password", "secret123"))
|
||||
require.NoError(t, flags.Set("redis-db", "3"))
|
||||
require.NoError(t, flags.Set("redis-prefix", "custom-prefix"))
|
||||
require.NoError(t, flags.Set("abi-cache-api-timeout", "16h"))
|
||||
require.NoError(t, flags.Set("telegram-id", "72983126312982618"))
|
||||
require.NoError(t, flags.Set("telegram-channel", "-293492332"))
|
||||
require.NoError(t, flags.Set("log-max-filesize", "25mb"))
|
||||
|
|
@ -160,6 +169,9 @@ func TestBuilder_Flags(t *testing.T) {
|
|||
MaxTime: time.Minute * 10,
|
||||
FileTimestampFormat: "0102-15:04:05",
|
||||
},
|
||||
AbiCache: AbiCache{
|
||||
ApiTimeout: time.Hour * 16,
|
||||
},
|
||||
Ship: ShipConfig{
|
||||
Url: "ws://myship.com:7823",
|
||||
StartBlockNum: 7327833,
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@ func GetFlags() *pflag.FlagSet {
|
|||
flags.String("telegram-id", "", "Id of telegram bot")
|
||||
flags.Int64("telegram-channel", 0, "Telegram channel to send notifications to")
|
||||
|
||||
// AbiCache
|
||||
flags.Duration("abi-cache-api-timeout", time.Second, "")
|
||||
|
||||
// Log
|
||||
flags.StringP("log", "l", "", "Path to log file (default: print to stdout/stderr)")
|
||||
flags.String("log-max-filesize", "10mb", "Max filesize for logfile to rotate")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/eosswedenorg/thalos/internal/log"
|
||||
"github.com/eosswedenorg/thalos/internal/types"
|
||||
)
|
||||
|
|
@ -18,6 +20,10 @@ type TelegramConfig struct {
|
|||
Channel int64 `yaml:"channel" mapstructure:"channel"`
|
||||
}
|
||||
|
||||
type AbiCache struct {
|
||||
ApiTimeout time.Duration `yaml:"api_timeout" mapstructure:"api_timeout"`
|
||||
}
|
||||
|
||||
type ShipConfig struct {
|
||||
Url string `yaml:"url" mapstructure:"url"`
|
||||
IrreversibleOnly bool `yaml:"irreversible_only" mapstructure:"irreversible_only"`
|
||||
|
|
@ -39,5 +45,7 @@ type Config struct {
|
|||
Redis RedisConfig `yaml:"redis" mapstructure:"redis"`
|
||||
MessageCodec string `yaml:"message_codec" mapstructure:"message_codec"`
|
||||
|
||||
AbiCache AbiCache `yaml:"abi_cache" mapstructure:"abi_cache"`
|
||||
|
||||
Telegram TelegramConfig `yaml:"telegram" mapstructure:"telegram"`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue