ziwen 1 year ago
parent
commit
ffbddbc1c1
3 changed files with 14 additions and 7 deletions
  1. 4 1
      controllers/sys_role.go
  2. 9 5
      services/minio.go
  3. 1 1
      services/task.go

+ 4 - 1
controllers/sys_role.go

@@ -705,7 +705,10 @@ func (this *SysRoleController) SystemConfig() {
 	}, system.BusinessConf{
 		ConfKey: "ChartViewUrl",
 		ConfVal: conf["ChartViewUrl"],
-	})
+	}, system.BusinessConf{
+		ConfKey: "ObjectStorageClient",
+		ConfVal: conf["ObjectStorageClient"],
+	},)
 
 	br.Data = list
 	br.Ret = 200

+ 9 - 5
services/minio.go

@@ -2,6 +2,7 @@ package services
 
 import (
 	"context"
+	"fmt"
 	"github.com/minio/minio-go/v7"
 	"github.com/minio/minio-go/v7/pkg/credentials"
 	"log"
@@ -9,10 +10,10 @@ import (
 
 func UploadMinIo() {
 	ctx := context.Background()
-	endpoint := "http://8.136.199.33:9001/"
-	accessKeyID := "test"
-	secretAccessKey := "LfQ8uiJiLP7vLxjRrmNW"
-	useSSL := true
+	endpoint := "8.136.199.33:9000/"
+	accessKeyID := "LfQ8uiJiLP7vLxjRrmNW"
+	secretAccessKey := "IszGVHsNicJMQxHC46cYFtbrOiapo0ynwOIJ6c2R"
+	useSSL := false
 
 	// Initialize minio client object.
 	minioClient, err := minio.New(endpoint, &minio.Options{
@@ -39,7 +40,10 @@ func UploadMinIo() {
 	} else {
 		log.Printf("Successfully created %s\n", bucketName)
 	}
-
+	buckets,err := minioClient.ListBuckets(ctx)
+	for _, bucket := range buckets {
+		fmt.Println(bucket)
+	}
 	// Upload the zip file
 	objectName := "1111.xlsx"
 	filePath := "/Users/xi/Desktop/1111.xlsx"

+ 1 - 1
services/task.go

@@ -21,7 +21,7 @@ func Task() {
 		//StaticCompanyTryDay()
 		//return
 	}
-	UploadMinIo()
+
 	//FixPermissionStatus()
 	//GetCompanyInfo()
 	//ReportCount()