fix persistence config unmarshalling

This commit is contained in:
c9s 2021-05-02 18:16:34 +08:00
parent 20d673f769
commit e29d9af9c8
3 changed files with 7 additions and 6 deletions

1
go.sum
View File

@ -360,6 +360,7 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=

View File

@ -19,6 +19,7 @@ persistence:
database: "persistence" database: "persistence"
strategies: strategies:
- on: max
swing: swing:
symbolPosition: symbolPosition:
persistence: persistence:

View File

@ -11,13 +11,12 @@ type Store interface {
} }
type RedisPersistenceConfig struct { type RedisPersistenceConfig struct {
Host string `json:"host" env:"REDIS_HOST"` Host string `yaml:"host" json:"host" env:"REDIS_HOST"`
Port string `json:"port" env:"REDIS_PORT"` Port string `yaml:"port" json:"port" env:"REDIS_PORT"`
Password string `json:"password" env:"REDIS_PASSWORD"` Password string `yaml:"password,omitempty" json:"password,omitempty" env:"REDIS_PASSWORD"`
DB int `json:"db" env:"REDIS_DB"` DB int `yaml:"db" json:"db" env:"REDIS_DB"`
} }
type JsonPersistenceConfig struct { type JsonPersistenceConfig struct {
Directory string `json:"directory"` Directory string `yaml:"directory" json:"directory"`
} }