36 lines
675 B
Go
Executable File
36 lines
675 B
Go
Executable File
package middlewares
|
|
|
|
import (
|
|
"backend/providers/app"
|
|
"backend/providers/jwt"
|
|
"backend/providers/storage"
|
|
"backend/providers/wechat"
|
|
|
|
"git.ipao.vip/rogeecn/atom/container"
|
|
"git.ipao.vip/rogeecn/atom/utils/opt"
|
|
)
|
|
|
|
func Provide(opts ...opt.Option) error {
|
|
if err := container.Container.Provide(func(
|
|
app *app.Config,
|
|
client *wechat.Client,
|
|
jwt *jwt.JWT,
|
|
storagePath *storage.Config,
|
|
) (*Middlewares, error) {
|
|
obj := &Middlewares{
|
|
app: app,
|
|
client: client,
|
|
jwt: jwt,
|
|
storagePath: storagePath,
|
|
}
|
|
if err := obj.Prepare(); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return obj, nil
|
|
}); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|