mirror of
https://github.com/eosswedenorg/thalos
synced 2026-07-04 12:03:41 +02:00
app/config/config.go: Adding MessageCodec field.
This commit is contained in:
parent
b221b0415a
commit
b5eb602e7d
2 changed files with 12 additions and 5 deletions
|
|
@ -34,12 +34,14 @@ type Config struct {
|
||||||
Api string `json:"api"`
|
Api string `json:"api"`
|
||||||
|
|
||||||
Redis RedisConfig `json:"redis"`
|
Redis RedisConfig `json:"redis"`
|
||||||
|
MessageCodec string `json:"message_codec"`
|
||||||
|
|
||||||
Telegram TelegramConfig `json:"telegram"`
|
Telegram TelegramConfig `json:"telegram"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func Parse(data []byte) (*Config, error) {
|
func Parse(data []byte) (*Config, error) {
|
||||||
cfg := Config{
|
cfg := Config{
|
||||||
|
MessageCodec: "json",
|
||||||
Ship: ShipConfig{
|
Ship: ShipConfig{
|
||||||
StartBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
StartBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
||||||
EndBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
EndBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ import (
|
||||||
|
|
||||||
func TestParse_Default(t *testing.T) {
|
func TestParse_Default(t *testing.T) {
|
||||||
expected := Config{
|
expected := Config{
|
||||||
|
MessageCodec: "json",
|
||||||
|
|
||||||
Ship: ShipConfig{
|
Ship: ShipConfig{
|
||||||
StartBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
StartBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
||||||
EndBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
EndBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
||||||
|
|
@ -34,6 +36,7 @@ func TestParse(t *testing.T) {
|
||||||
expected := Config{
|
expected := Config{
|
||||||
Name: "ship-reader-1",
|
Name: "ship-reader-1",
|
||||||
Api: "http://127.0.0.1:8080",
|
Api: "http://127.0.0.1:8080",
|
||||||
|
MessageCodec: "mojibake",
|
||||||
Ship: ShipConfig{
|
Ship: ShipConfig{
|
||||||
Url: "127.0.0.1:8089",
|
Url: "127.0.0.1:8089",
|
||||||
StartBlockNum: 23671836,
|
StartBlockNum: 23671836,
|
||||||
|
|
@ -56,6 +59,7 @@ func TestParse(t *testing.T) {
|
||||||
cfg, err := Parse([]byte(`{
|
cfg, err := Parse([]byte(`{
|
||||||
"name": "ship-reader-1",
|
"name": "ship-reader-1",
|
||||||
"api": "http://127.0.0.1:8080",
|
"api": "http://127.0.0.1:8080",
|
||||||
|
"message_codec": "mojibake",
|
||||||
"ship": {
|
"ship": {
|
||||||
"url": "127.0.0.1:8089",
|
"url": "127.0.0.1:8089",
|
||||||
"irreversible_only": true,
|
"irreversible_only": true,
|
||||||
|
|
@ -83,6 +87,7 @@ func TestParseShorthandShipUrl(t *testing.T) {
|
||||||
expected := Config{
|
expected := Config{
|
||||||
Name: "ship-reader-1",
|
Name: "ship-reader-1",
|
||||||
Api: "http://127.0.0.1:8080",
|
Api: "http://127.0.0.1:8080",
|
||||||
|
MessageCodec: "json",
|
||||||
Ship: ShipConfig{
|
Ship: ShipConfig{
|
||||||
Url: "127.0.0.1:8089",
|
Url: "127.0.0.1:8089",
|
||||||
StartBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
StartBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue