Pu Zhibing
21 小时以前 7bf07f46d7c39fa01b6d8abd860bd80c210d86cb
ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GoogleCloudStorageUtil.java
@@ -36,8 +36,8 @@
      // The path to your file to upload
      // String filePath = "path/to/your/file"
      String fileName = file.getOriginalFilename();
      String projectId = "i-go-gcp";
      String bucketName = "i-go";
      String projectId = "i-go-cloud";
      String bucketName = "i-go-gcs-public";
        GoogleCredentials defaultCredentials = null;
        try {
            defaultCredentials = GoogleCredentials.getApplicationDefault();
@@ -74,7 +74,7 @@
         storage.createFrom(blobInfo, file.getInputStream(), precondition);
         System.out.println(
               "File uploaded to bucket " + bucketName + " as " + fileName);
         makeObjectPublic(projectId, bucketName, fileName);
         return "https://storage.googleapis.com/i-go/" + fileName;
      } catch (IOException e) {
@@ -99,5 +99,5 @@
      System.out.println(
            "Object " + objectName + " in bucket " + bucketName + " was made publicly readable");
   }
}