@@ -32,7 +32,7 @@ type apiParams struct {
3232type API struct {
3333 seqapi.UnimplementedSeqAPIServiceServer
3434
35- config config.Handlers
35+ config config.SeqAPI
3636 params apiParams
3737 paramsByEnv map [string ]apiParams
3838 inmemWithRedisCache cache.Cache
@@ -44,31 +44,31 @@ type API struct {
4444}
4545
4646func New (
47- cfg config.Handlers ,
47+ cfg config.SeqAPI ,
4848 seqDBСlients map [string ]seqdb.Client ,
4949 inmemWithRedisCache cache.Cache ,
5050 redisCache cache.Cache ,
5151 asyncSearches * asyncsearches.Service ,
5252 p * profiles.Profiles ,
5353) * API {
5454 var globalfCache * fieldsCache
55- if cfg .SeqAPI . FieldsCacheTTL > 0 {
56- globalfCache = newFieldsCache (cfg .SeqAPI . FieldsCacheTTL )
55+ if cfg .FieldsCacheTTL > 0 {
56+ globalfCache = newFieldsCache (cfg .FieldsCacheTTL )
5757 }
5858
59- globalMasker , err := mask .New (cfg .SeqAPI . Masking )
59+ globalMasker , err := mask .New (cfg .Masking )
6060 if err != nil {
6161 logger .Fatal ("failed to init masking" , zap .Error (err ))
6262 }
6363
64- globalPinnedFields := parsePinnedFields (cfg .SeqAPI . PinnedFields )
64+ globalPinnedFields := parsePinnedFields (cfg .PinnedFields )
6565
6666 var params apiParams
6767 var paramsByEnv map [string ]apiParams
6868
69- if len (cfg .SeqAPI . Envs ) > 0 {
69+ if len (cfg .Envs ) > 0 {
7070 paramsByEnv = make (map [string ]apiParams )
71- for envName , envConfig := range cfg .SeqAPI . Envs {
71+ for envName , envConfig := range cfg .Envs {
7272 client := seqDBСlients [envConfig .SeqDB ]
7373 options := envConfig .Options
7474
@@ -101,7 +101,7 @@ func New(
101101
102102 params = apiParams {
103103 client : client ,
104- options : cfg .SeqAPI . SeqAPIOptions ,
104+ options : cfg .SeqAPIOptions ,
105105 fieldsCache : globalfCache ,
106106 masker : globalMasker ,
107107 pinnedFields : globalPinnedFields ,
@@ -117,7 +117,7 @@ func New(
117117 nowFn : time .Now ,
118118 asyncSearches : asyncSearches ,
119119 profiles : p ,
120- envsResponse : parseEnvs (cfg . SeqAPI ),
120+ envsResponse : parseEnvs (cfg ),
121121 }
122122}
123123
@@ -191,12 +191,12 @@ func (a *API) GetEnvFromContext(ctx context.Context) string {
191191}
192192
193193func (a * API ) GetParams (env string ) (apiParams , error ) {
194- if len (a .config .SeqAPI . Envs ) == 0 {
194+ if len (a .config .Envs ) == 0 {
195195 return a .params , nil
196196 }
197197
198198 if env == "" {
199- env = a .config .SeqAPI . DefaultEnv
199+ env = a .config .DefaultEnv
200200 }
201201
202202 params , exists := a .paramsByEnv [env ]
0 commit comments