servicecontext.go 444 B

1234567891011121314151617181920212223
  1. package svc
  2. import (
  3. "app.yhyue.com/moapp/jyfs/rpc/internal/config"
  4. "github.com/aliyun/aliyun-oss-go-sdk/oss"
  5. "log"
  6. )
  7. type ServiceContext struct {
  8. Config config.Config
  9. OssClient *oss.Client
  10. }
  11. func NewServiceContext(c config.Config) *ServiceContext {
  12. client, err := oss.New(c.OssEndPoint, c.OssAccessKeyId, c.OssAccessKeySecret)
  13. if err != nil {
  14. log.Fatal(err)
  15. }
  16. return &ServiceContext{
  17. Config: c,
  18. OssClient: client,
  19. }
  20. }