Back to returning interface in NewInternalAPI

This commit is contained in:
Piotr Kozimor 2021-08-11 06:03:45 +02:00
parent c7f8e6d3bb
commit 3827837d76
2 changed files with 3 additions and 3 deletions

View file

@ -38,7 +38,7 @@ func AddInternalRoutes(router *mux.Router, intAPI api.UserInternalAPI) {
// can call functions directly on the returned API or via an HTTP interface using AddInternalRoutes. // can call functions directly on the returned API or via an HTTP interface using AddInternalRoutes.
func NewInternalAPI( func NewInternalAPI(
accountDB accounts.Database, cfg *config.UserAPI, appServices []config.ApplicationService, keyAPI keyapi.KeyInternalAPI, accountDB accounts.Database, cfg *config.UserAPI, appServices []config.ApplicationService, keyAPI keyapi.KeyInternalAPI,
) *internal.UserInternalAPI { ) api.UserInternalAPI {
deviceDB, err := devices.NewDatabase(&cfg.DeviceDatabase, cfg.Matrix.ServerName) deviceDB, err := devices.NewDatabase(&cfg.DeviceDatabase, cfg.Matrix.ServerName)
if err != nil { if err != nil {
logrus.WithError(err).Panicf("failed to connect to device db") logrus.WithError(err).Panicf("failed to connect to device db")

View file

@ -75,8 +75,8 @@ func mustMakeInternalAPI(is *is.I) (*internal.UserInternalAPI, accounts.Database
TemplatesPath: "../res/default", TemplatesPath: "../res/default",
}, },
} }
apiInt := userapi.NewInternalAPI(accountDB, cfg, nil, nil).(*internal.UserInternalAPI)
return userapi.NewInternalAPI(accountDB, cfg, nil, nil), accountDB return apiInt, accountDB
} }
func TestQueryProfile(t *testing.T) { func TestQueryProfile(t *testing.T) {