mirror of https://github.com/Xhofe/alist
fix(s3): don't bind s3 port if s3 is not enabled (#6291)
parent
d8e190406a
commit
58c3cb3cf6
|
@ -91,10 +91,10 @@ the address is defined in config file`,
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
if conf.Conf.S3.Port != -1 && conf.Conf.S3.Enable {
|
||||||
s3r := gin.New()
|
s3r := gin.New()
|
||||||
s3r.Use(gin.LoggerWithWriter(log.StandardLogger().Out), gin.RecoveryWithWriter(log.StandardLogger().Out))
|
s3r.Use(gin.LoggerWithWriter(log.StandardLogger().Out), gin.RecoveryWithWriter(log.StandardLogger().Out))
|
||||||
server.InitS3(s3r)
|
server.InitS3(s3r)
|
||||||
if conf.Conf.S3.Port != -1 {
|
|
||||||
s3Base := fmt.Sprintf("%s:%d", conf.Conf.Scheme.Address, conf.Conf.S3.Port)
|
s3Base := fmt.Sprintf("%s:%d", conf.Conf.Scheme.Address, conf.Conf.S3.Port)
|
||||||
utils.Log.Infof("start S3 server @ %s", s3Base)
|
utils.Log.Infof("start S3 server @ %s", s3Base)
|
||||||
go func() {
|
go func() {
|
||||||
|
|
|
@ -34,12 +34,6 @@ func S3(g *gin.RouterGroup) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func S3Server(g *gin.RouterGroup) {
|
func S3Server(g *gin.RouterGroup) {
|
||||||
if !conf.Conf.S3.Enable {
|
|
||||||
g.Any("/*path", func(c *gin.Context) {
|
|
||||||
common.ErrorStrResp(c, "S3 server is not enabled", 403)
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
h, _ := s3.NewServer(context.Background())
|
h, _ := s3.NewServer(context.Background())
|
||||||
g.Any("/*path", gin.WrapH(h))
|
g.Any("/*path", gin.WrapH(h))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue