任务三
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package conf
|
||||
|
||||
import "github.com/google/wire"
|
||||
|
||||
// ProviderSet is conf providers.
|
||||
var ProviderSet = wire.NewSet(
|
||||
ProvideServer,
|
||||
ProvideJWT,
|
||||
ProvideMysql,
|
||||
ProvideCaptcha,
|
||||
ProvideSystem,
|
||||
ProvideUseStrictAuth,
|
||||
)
|
||||
|
||||
// ProvideServer 提供Server配置
|
||||
func ProvideServer(c *Bootstrap) *Server {
|
||||
return c.Server
|
||||
}
|
||||
|
||||
// ProvideJWT 提供JWT配置
|
||||
func ProvideJWT(c *Bootstrap) *JWT {
|
||||
return c.Jwt
|
||||
}
|
||||
|
||||
// ProvideMysql 提供Mysql配置
|
||||
func ProvideMysql(c *Bootstrap) *Mysql {
|
||||
return c.Mysql
|
||||
}
|
||||
|
||||
// ProvideCaptcha 提供Captcha配置
|
||||
func ProvideCaptcha(c *Bootstrap) *Captcha {
|
||||
return c.Captcha
|
||||
}
|
||||
|
||||
// ProvideSystem 提供System配置
|
||||
func ProvideSystem(c *Bootstrap) *System {
|
||||
return c.System
|
||||
}
|
||||
|
||||
// UseStrictAuth 用于wire注入的类型包装
|
||||
type UseStrictAuth bool
|
||||
|
||||
// ProvideUseStrictAuth 提供UseStrictAuth配置
|
||||
func ProvideUseStrictAuth(c *System) UseStrictAuth {
|
||||
if c == nil {
|
||||
return false
|
||||
}
|
||||
return UseStrictAuth(c.UseStrictAuth)
|
||||
}
|
||||
Reference in New Issue
Block a user