init repo
This commit is contained in:
40
rpc/manager.go
Normal file
40
rpc/manager.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"github.com/Timothylock/go-signin-with-apple/apple"
|
||||
"github.com/nose7en/ToyBoomServer/config"
|
||||
)
|
||||
|
||||
type Manager interface {
|
||||
AppleCli() *AppleClient
|
||||
}
|
||||
|
||||
var (
|
||||
mgr Manager = (*manager)(nil)
|
||||
)
|
||||
|
||||
func GetManager() Manager {
|
||||
return mgr
|
||||
}
|
||||
|
||||
func InitManager() {
|
||||
mgr = &manager{}
|
||||
}
|
||||
|
||||
type manager struct {
|
||||
appleCli *AppleClient
|
||||
}
|
||||
|
||||
func (m *manager) AppleCli() *AppleClient {
|
||||
if m.appleCli == nil {
|
||||
m.appleCli = &AppleClient{
|
||||
Client: apple.New(),
|
||||
teamID: config.GetSettings().AppleCfg.TeamID,
|
||||
clientID: config.GetSettings().AppleCfg.ClientID,
|
||||
keyID: config.GetSettings().AppleCfg.KeyID,
|
||||
secret: config.GetSettings().AppleCfg.Secret,
|
||||
}
|
||||
}
|
||||
|
||||
return m.appleCli
|
||||
}
|
||||
Reference in New Issue
Block a user