Skip to content

Commit

Permalink
as: Refactor configuration derivation
Browse files Browse the repository at this point in the history
  • Loading branch information
adriansmares committed Apr 18, 2024
1 parent a7af3e0 commit 0ca7253
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions pkg/applicationserver/applicationserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1499,14 +1499,10 @@ func (as *ApplicationServer) decryptDownlinkMessage(ctx context.Context, ids *tt
return as.decryptAndDecodeDownlink(ctx, dev, msg, link.DefaultFormatters)
}

type ctxConfigKeyType struct{}

// GetConfig returns the Application Server config based on the context.
func (as *ApplicationServer) GetConfig(ctx context.Context) (*Config, error) {
if val, ok := ctx.Value(&ctxConfigKeyType{}).(*Config); ok {
return val, nil
}
return as.config, nil
c := *as.config
return &c, nil
}

// GetMQTTConfig returns the MQTT frontend configuration based on the context.
Expand Down

0 comments on commit 0ca7253

Please sign in to comment.