feat: 完成连接测试和新建s3连接函数
This commit is contained in:
@ -2,6 +2,7 @@ package handler
|
||||
|
||||
import (
|
||||
"nf-disk/internal/ndh"
|
||||
"nf-disk/internal/s3"
|
||||
)
|
||||
|
||||
func ConnectionTest(c *ndh.Ctx) error {
|
||||
@ -21,5 +22,13 @@ func ConnectionTest(c *ndh.Ctx) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if req.Endpoint == "" || req.Access == "" || req.Key == "" {
|
||||
return c.Send400(nil, "endpoint, secret_access, secret_key 是必填项")
|
||||
}
|
||||
|
||||
if _, err = s3.New(c.Context(), req.Endpoint, req.Access, req.Key); err != nil {
|
||||
return c.Send500(err.Error(), "连接失败")
|
||||
}
|
||||
|
||||
return c.Send200("test success")
|
||||
}
|
||||
|
Reference in New Issue
Block a user