merge remote-tracking branch 'origin/master'

This commit is contained in:
Brad Rydzewski 2019-02-27 23:07:30 -08:00
commit d240eadb65
4 changed files with 23 additions and 11 deletions

View file

@ -330,9 +330,10 @@ type (
// S3 provides the storage configuration.
S3 struct {
Bucket string `envconfig:"DRONE_S3_BUCKET"`
Prefix string `envconfig:"DRONE_S3_PREFIX"`
Endpoint string `envconfig:"DRONE_S3_ENDPOINT"`
Bucket string `envconfig:"DRONE_S3_BUCKET"`
Prefix string `envconfig:"DRONE_S3_PREFIX"`
Endpoint string `envconfig:"DRONE_S3_ENDPOINT"`
PathStyle bool `envconfig:"DRONE_S3_PATH_STYLE"`
}
// HTTP provides http configuration.

View file

@ -86,6 +86,7 @@ func provideLogStore(db *db.DB, config config.Config) core.LogStore {
config.S3.Bucket,
config.S3.Prefix,
config.S3.Endpoint,
config.S3.PathStyle,
)
}

View file

@ -24,6 +24,7 @@ import (
globalbuilds "github.com/drone/drone/handler/api/builds"
"github.com/drone/drone/handler/api/ccmenu"
"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/builds"
"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))
})
// r.Route("/queue", func(r chi.Router) {
// r.Use(acl.AuthorizeAdmin)
// r.Get("/", queue.HandleItems(s.Stages))
// r.Post("/", queue.HandleResume(s.Queue))
// r.Delete("/", queue.HandlePause(s.Queue))
// })
r.Route("/queue", func(r chi.Router) {
r.Use(acl.AuthorizeAdmin)
r.Get("/", queue.HandleItems(s.Stages))
// r.Post("/", queue.HandleResume(s.Queue))
// r.Delete("/", queue.HandlePause(s.Queue))
})
r.Route("/user", func(r chi.Router) {
r.Use(acl.AuthorizeUser)

View file

@ -11,6 +11,7 @@ import (
"fmt"
"io"
"path"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
@ -24,13 +25,21 @@ import (
// s3gof3r as an alternate. github.com/rlmcpherson/s3gof3r
// 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{
bucket: bucket,
prefix: prefix,
session: session.Must(
session.NewSession(&aws.Config{
Endpoint: aws.String(endpoint),
Endpoint: aws.String(endpoint),
DisableSSL: aws.Bool(disableSSL),
S3ForcePathStyle: aws.Bool(pathStyle),
}),
),
}