Skip to content

Commit

Permalink
Merge pull request #22 from berty/dev/moul/bearer
Browse files Browse the repository at this point in the history
feat: Configure Bearer
  • Loading branch information
moul authored Feb 24, 2020
2 parents 7e8bf38 + 60f0888 commit 4b79858
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion circleci.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func fetchCircleci(ccc *circleci.Client, since time.Time, maxBuilds int, logger
newBuilds := make([]*circleci.Build, len(builds))
i := 0
for _, build := range builds {
if build.AuthorDate.After(since) {
if build.AuthorDate != nil && build.AuthorDate.After(since) {
newBuilds[i] = build
i++
}
Expand All @@ -115,6 +115,9 @@ func fetchCircleci(ccc *circleci.Client, since time.Time, maxBuilds int, logger
func handleCircleciBuilds(ccc *circleci.Client, builds []*circleci.Build, logger *zap.Logger) (Batch, error) {
batch := Batch{Builds: []*Build{}}
for _, build := range builds {
if build == nil {
continue
}
b := circleciBuildToBatch(build)
batch.Builds = append(batch.Builds, &b)

Expand Down
6 changes: 6 additions & 0 deletions cmd/yolo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"time"

yolo "berty.tech/yolo/v2"
bearer "github.com/Bearer/bearer-go"
"github.com/buildkite/go-buildkite/buildkite"
"github.com/cayleygraph/cayley"
"github.com/cayleygraph/cayley/graph"
Expand All @@ -31,6 +32,7 @@ func main() {
var (
verbose bool
maxBuilds int
bearerSecretKey string
buildkiteToken string
circleciToken string
dbStorePath string
Expand Down Expand Up @@ -60,6 +62,7 @@ func main() {
serverFlagSet.DurationVar(&shutdownTimeout, "shutdown-timeout", 6*time.Second, "server shutdown timeout")
serverFlagSet.StringVar(&basicAuth, "basic-auth-password", "", "if set, enables basic authentication")
serverFlagSet.StringVar(&realm, "realm", "Yolo", "authentication Realm")
serverFlagSet.StringVar(&bearerSecretKey, "bearer-secretkey", "", "optional Bearer.sh Secret Key")

server := &ffcli.Command{
Name: `server`,
Expand All @@ -71,6 +74,9 @@ func main() {
if err != nil {
return err
}
if bearerSecretKey != "" {
bearer.ReplaceGlobals(bearer.Init(bearerSecretKey))
}
db, dbCleanup, err := dbFromArgs(dbStorePath, logger)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4b79858

Please sign in to comment.