mirror of
https://github.com/eosswedenorg/thalos
synced 2026-08-31 21:08:14 +02:00
internal/config: remove shorthand ship config (where it is possible to have "ship" key only contain a url string instead of struct)
It makes parsing harder and i don't think anyone uses it and its not that useful tbh.
This commit is contained in:
parent
4a4489e2be
commit
e54a4fa929
3 changed files with 6 additions and 78 deletions
|
|
@ -7,8 +7,6 @@ import (
|
|||
|
||||
"github.com/eosswedenorg/thalos/internal/log"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
shipclient "github.com/eosswedenorg-go/antelope-ship-client"
|
||||
)
|
||||
|
||||
func TestBuilder(t *testing.T) {
|
||||
|
|
@ -154,55 +152,6 @@ func TestBuilder_NilSource(t *testing.T) {
|
|||
require.EqualError(t, err, "Config not set")
|
||||
}
|
||||
|
||||
func TestBuilder_WithShorthandShipUrl(t *testing.T) {
|
||||
expected := Config{
|
||||
Name: "ship-reader-1",
|
||||
Api: "http://127.0.0.1:8080",
|
||||
MessageCodec: "json",
|
||||
Log: log.Config{
|
||||
MaxFileSize: 10 * 1000 * 1000, // 10 mb
|
||||
MaxTime: time.Hour * 24,
|
||||
},
|
||||
Ship: ShipConfig{
|
||||
Url: "127.0.0.1:8089",
|
||||
StartBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
||||
EndBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
||||
MaxMessagesInFlight: 10,
|
||||
IrreversibleOnly: false,
|
||||
},
|
||||
Telegram: TelegramConfig{
|
||||
Id: "110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw",
|
||||
Channel: -123456789,
|
||||
},
|
||||
Redis: RedisConfig{
|
||||
Addr: "localhost:6379",
|
||||
Password: "passwd",
|
||||
DB: 4,
|
||||
Prefix: "some::ship",
|
||||
},
|
||||
}
|
||||
|
||||
builder := NewBuilder()
|
||||
builder.SetSource(bytes.NewBuffer([]byte(`
|
||||
name: "ship-reader-1"
|
||||
api: "http://127.0.0.1:8080"
|
||||
ship: "127.0.0.1:8089"
|
||||
telegram:
|
||||
id: "110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw"
|
||||
channel: -123456789
|
||||
redis:
|
||||
addr: "localhost:6379"
|
||||
password: "passwd"
|
||||
db: 4
|
||||
prefix: "some::ship"
|
||||
`)))
|
||||
|
||||
cfg, err := builder.Build()
|
||||
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &expected, cfg)
|
||||
}
|
||||
|
||||
func TestBuilder_Flags(t *testing.T) {
|
||||
flags := GetFlags()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue