21 lines
340 B
Go
21 lines
340 B
Go
|
package auth
|
||
|
|
||
|
import (
|
||
|
"github.com/pkg/errors"
|
||
|
"gitlab.com/wpetit/goweb/service"
|
||
|
)
|
||
|
|
||
|
func ServiceProvider(rules []string) service.Provider {
|
||
|
srv := NewService()
|
||
|
|
||
|
err := srv.LoadRules(rules...)
|
||
|
|
||
|
return func(ctn *service.Container) (interface{}, error) {
|
||
|
if err != nil {
|
||
|
return nil, errors.WithStack(err)
|
||
|
}
|
||
|
|
||
|
return srv, nil
|
||
|
}
|
||
|
}
|