feat: first version.

This commit is contained in:
tx7do
2023-05-21 10:04:15 +08:00
parent 3656de9753
commit 785443dd84
51 changed files with 15841 additions and 0 deletions

23
oss.go Normal file
View File

@@ -0,0 +1,23 @@
package bootstrap
import (
"github.com/go-kratos/kratos/v2/log"
"github.com/minio/minio-go/v7/pkg/credentials"
"github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1"
)
func NewMinIoClient(conf *conf.OSS) *minio.Client {
impl, err := minio.New(conf.Minio.Endpoint,
&minio.Options{
Creds: credentials.NewStaticV4(conf.Minio.AccessKey, conf.Minio.SecretKey, conf.Minio.Token),
Secure: conf.Minio.UseSsl,
},
)
if err != nil {
log.Fatal("failed opening connection to minio", err)
return nil
}
return impl
}