merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
d240eadb65
4 changed files with 23 additions and 11 deletions
|
@ -330,9 +330,10 @@ type (
|
||||||
|
|
||||||
// S3 provides the storage configuration.
|
// S3 provides the storage configuration.
|
||||||
S3 struct {
|
S3 struct {
|
||||||
Bucket string `envconfig:"DRONE_S3_BUCKET"`
|
Bucket string `envconfig:"DRONE_S3_BUCKET"`
|
||||||
Prefix string `envconfig:"DRONE_S3_PREFIX"`
|
Prefix string `envconfig:"DRONE_S3_PREFIX"`
|
||||||
Endpoint string `envconfig:"DRONE_S3_ENDPOINT"`
|
Endpoint string `envconfig:"DRONE_S3_ENDPOINT"`
|
||||||
|
PathStyle bool `envconfig:"DRONE_S3_PATH_STYLE"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// HTTP provides http configuration.
|
// HTTP provides http configuration.
|
||||||
|
|
|
@ -86,6 +86,7 @@ func provideLogStore(db *db.DB, config config.Config) core.LogStore {
|
||||||
config.S3.Bucket,
|
config.S3.Bucket,
|
||||||
config.S3.Prefix,
|
config.S3.Prefix,
|
||||||
config.S3.Endpoint,
|
config.S3.Endpoint,
|
||||||
|
config.S3.PathStyle,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import (
|
||||||
globalbuilds "github.com/drone/drone/handler/api/builds"
|
globalbuilds "github.com/drone/drone/handler/api/builds"
|
||||||
"github.com/drone/drone/handler/api/ccmenu"
|
"github.com/drone/drone/handler/api/ccmenu"
|
||||||
"github.com/drone/drone/handler/api/events"
|
"github.com/drone/drone/handler/api/events"
|
||||||
|
"github.com/drone/drone/handler/api/queue"
|
||||||
"github.com/drone/drone/handler/api/repos"
|
"github.com/drone/drone/handler/api/repos"
|
||||||
"github.com/drone/drone/handler/api/repos/builds"
|
"github.com/drone/drone/handler/api/repos/builds"
|
||||||
"github.com/drone/drone/handler/api/repos/builds/logs"
|
"github.com/drone/drone/handler/api/repos/builds/logs"
|
||||||
|
@ -239,12 +240,12 @@ func (s Server) Handler() http.Handler {
|
||||||
).Get("/cc.xml", ccmenu.Handler(s.Repos, s.Builds, s.System.Link))
|
).Get("/cc.xml", ccmenu.Handler(s.Repos, s.Builds, s.System.Link))
|
||||||
})
|
})
|
||||||
|
|
||||||
// r.Route("/queue", func(r chi.Router) {
|
r.Route("/queue", func(r chi.Router) {
|
||||||
// r.Use(acl.AuthorizeAdmin)
|
r.Use(acl.AuthorizeAdmin)
|
||||||
// r.Get("/", queue.HandleItems(s.Stages))
|
r.Get("/", queue.HandleItems(s.Stages))
|
||||||
// r.Post("/", queue.HandleResume(s.Queue))
|
// r.Post("/", queue.HandleResume(s.Queue))
|
||||||
// r.Delete("/", queue.HandlePause(s.Queue))
|
// r.Delete("/", queue.HandlePause(s.Queue))
|
||||||
// })
|
})
|
||||||
|
|
||||||
r.Route("/user", func(r chi.Router) {
|
r.Route("/user", func(r chi.Router) {
|
||||||
r.Use(acl.AuthorizeUser)
|
r.Use(acl.AuthorizeUser)
|
||||||
|
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/aws/session"
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
|
@ -24,13 +25,21 @@ import (
|
||||||
// s3gof3r as an alternate. github.com/rlmcpherson/s3gof3r
|
// s3gof3r as an alternate. github.com/rlmcpherson/s3gof3r
|
||||||
|
|
||||||
// NewS3Env returns a new S3 log store.
|
// NewS3Env returns a new S3 log store.
|
||||||
func NewS3Env(bucket, prefix, endpoint string) core.LogStore {
|
func NewS3Env(bucket, prefix, endpoint string, pathStyle bool) core.LogStore {
|
||||||
|
disableSSL := false
|
||||||
|
|
||||||
|
if endpoint != "" {
|
||||||
|
disableSSL = !strings.HasPrefix(endpoint, "https://")
|
||||||
|
}
|
||||||
|
|
||||||
return &s3store{
|
return &s3store{
|
||||||
bucket: bucket,
|
bucket: bucket,
|
||||||
prefix: prefix,
|
prefix: prefix,
|
||||||
session: session.Must(
|
session: session.Must(
|
||||||
session.NewSession(&aws.Config{
|
session.NewSession(&aws.Config{
|
||||||
Endpoint: aws.String(endpoint),
|
Endpoint: aws.String(endpoint),
|
||||||
|
DisableSSL: aws.Bool(disableSSL),
|
||||||
|
S3ForcePathStyle: aws.Bool(pathStyle),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue