Skip to content

Commit

Permalink
Set secure: true
Browse files Browse the repository at this point in the history
  • Loading branch information
rxdn committed Jul 3, 2024
1 parent f7485e0 commit 3c44350
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 10 deletions.
3 changes: 2 additions & 1 deletion cmd/cleanuser/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ func main() {
}

client, err := minio.New(cfg.Endpoint, &minio.Options{
Creds: credentials.NewStaticV4(cfg.AccessKey, cfg.SecretKey, ""),
Creds: credentials.NewStaticV4(cfg.AccessKey, cfg.SecretKey, ""),
Secure: true,
})

if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion cmd/deletetranscript/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ func main() {
}

m, err := minio.New(cfg.Endpoint, &minio.Options{
Creds: credentials.NewStaticV4(cfg.AccessKey, cfg.SecretKey, ""),
Creds: credentials.NewStaticV4(cfg.AccessKey, cfg.SecretKey, ""),
Secure: true,
})

if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion cmd/exportguild/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ func main() {

// create minio client
m, err := minio.New(conf.Endpoint, &minio.Options{
Creds: credentials.NewStaticV4(conf.AccessKey, conf.SecretKey, ""),
Creds: credentials.NewStaticV4(conf.AccessKey, conf.SecretKey, ""),
Secure: true,
})
if err != nil {
panic(err)
Expand Down
3 changes: 2 additions & 1 deletion cmd/exportuser/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ func main() {
func getTranscripts(conf config.Config, tickets map[uint64][]int) {
// create minio client
m, err := minio.New(conf.Endpoint, &minio.Options{
Creds: credentials.NewStaticV4(conf.AccessKey, conf.SecretKey, ""),
Creds: credentials.NewStaticV4(conf.AccessKey, conf.SecretKey, ""),
Secure: true,
})
if err != nil {
panic(err)
Expand Down
8 changes: 3 additions & 5 deletions cmd/fix-file-names/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ func main() {

// create minio client
client, err := minio.New(conf.Endpoint, &minio.Options{
Creds: credentials.NewStaticV4(conf.AccessKey, conf.SecretKey, ""),
Creds: credentials.NewStaticV4(conf.AccessKey, conf.SecretKey, ""),
Secure: true,
})
if err != nil {
panic(err)
Expand All @@ -31,11 +32,8 @@ func main() {
panic(err)
}

doneCh := make(chan struct{})
defer close(doneCh)

ch := client.ListObjects(context.Background(), conf.Bucket, minio.ListObjectsOptions{
Prefix: "",
Prefix: "8",
Recursive: true,
})

Expand Down
3 changes: 2 additions & 1 deletion cmd/logarchiver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ func main() {

// create minio client
client, err := minio.New(conf.Endpoint, &minio.Options{
Creds: credentials.NewStaticV4(conf.AccessKey, conf.SecretKey, ""),
Creds: credentials.NewStaticV4(conf.AccessKey, conf.SecretKey, ""),
Secure: true,
})
if err != nil {
logger.Fatal("Failed to create minio client", zap.Error(err), zap.String("endpoint", conf.Endpoint))
Expand Down
1 change: 1 addition & 0 deletions pkg/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func (s *Server) RegisterRoutes() {

s.router.GET("/", s.ticketGetHandler)
s.router.POST("/", s.ticketUploadHandler)
s.router.DELETE("/", s.ticketDeleteHandler)

s.router.GET("/guild/status/:id", s.purgeStatusHandler)
s.router.DELETE("/guild/:id", s.purgeGuildHandler)
Expand Down
33 changes: 33 additions & 0 deletions pkg/http/ticketdelete.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package http

import (
"github.com/gin-gonic/gin"
"net/http"
"strconv"
)

func (s *Server) ticketDeleteHandler(ctx *gin.Context) {
guild, err := strconv.ParseUint(ctx.Query("guild"), 10, 64)
if err != nil {
ctx.JSON(400, gin.H{
"message": "missing guild ID",
})
return
}

id, err := strconv.Atoi(ctx.Query("id"))
if err != nil {
ctx.JSON(400, gin.H{
"message": "missing ticket ID",
})
return
}

if err := s.s3.DeleteTicket(ctx, guild, id); err != nil {
ctx.JSON(500, gin.H{
"message": err.Error(),
})
}

ctx.Status(http.StatusNoContent)
}

0 comments on commit 3c44350

Please sign in to comment.