-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
29 lines (24 loc) · 854 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package main
import (
"log"
"taurus-minio/client"
"taurus-minio/encryption"
"taurus-minio/files"
"github.com/gin-gonic/gin"
)
func main() {
// Create minio client and read configuration files
minioClient := client.CreateMinioClient()
log.Printf("Is Online: %t\n", minioClient.IsOnline())
// Typically for first start, if no bucket is present.
minioClient.CreateBucket()
// Create cryptographer for encrypting/decrypting
cryptographer := encryption.InitEncrypter(minioClient.GetEncryptionKey())
// Create file handler, responsible for receiving/sending/chunking/encrypting files
fh := files.InitFileHandler(minioClient, cryptographer)
// start gin
router := gin.Default()
router.POST("/upload/file", fh.UploadFilesHandler) // upload a file
router.GET("/file/:name", fh.GetFileFromIDHandler) // get file by id
router.Run(":8080")
}