Skip to content

Commit

Permalink
Merge pull request #249 from moul/dev/moul/bearer
Browse files Browse the repository at this point in the history
feat: set up bearer agent
  • Loading branch information
moul authored Feb 26, 2020
2 parents 86542a1 + f65123e commit 1216253
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
15 changes: 11 additions & 4 deletions cmd/depviz/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"os/signal"
"time"

bearer "github.com/Bearer/bearer-go"
"github.com/cayleygraph/cayley"
"github.com/cayleygraph/cayley/graph"
_ "github.com/cayleygraph/cayley/graph/kv/bolt"
Expand All @@ -32,10 +33,11 @@ var (
logger *zap.Logger
schemaConfig *schema.Config

globalFlags = flag.NewFlagSet("depviz", flag.ExitOnError)
globalStorePath = globalFlags.String("store-path", os.Getenv("HOME")+"/.depviz", "store path")
globalDebug = globalFlags.Bool("debug", false, "debug mode")
globalWithStacktrace = globalFlags.Bool("with-stacktrace", false, "show stacktrace on warns, errors and worse")
globalFlags = flag.NewFlagSet("depviz", flag.ExitOnError)
globalStorePath = globalFlags.String("store-path", os.Getenv("HOME")+"/.depviz", "store path")
globalDebug = globalFlags.Bool("debug", false, "debug mode")
globalWithStacktrace = globalFlags.Bool("with-stacktrace", false, "show stacktrace on warns, errors and worse")
globalBearerSecretKey = globalFlags.String("bearer-secretkey", "", "optional bearer.sh secret key")

airtableFlags = flag.NewFlagSet("airtable", flag.ExitOnError)
airtableToken = airtableFlags.String("token", "", "airtable token")
Expand Down Expand Up @@ -105,6 +107,7 @@ func main() {
}, {
Name: "store",
ShortHelp: "manage the data store",
Options: []ff.Option{ff.WithEnvVarNoPrefix()},
Subcommands: []*ffcli.Command{
{Name: "dump-quads", Exec: execStoreDumpQuads},
{Name: "dump-json", Exec: execStoreDumpJSON},
Expand Down Expand Up @@ -142,6 +145,10 @@ func main() {
func globalPreRun() error {
rand.Seed(srand.Secure())

if *globalBearerSecretKey != "" {
bearer.ReplaceGlobals(bearer.Init(*globalBearerSecretKey))
}

config := zap.NewDevelopmentConfig()
config.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
if *globalDebug {
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.

3 changes: 3 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 1216253

Please sign in to comment.