Skip to content

Commit f65123e

Browse files
committed
feat: set up bearer agent
1 parent 86542a1 commit f65123e

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

cmd/depviz/main.go

+11-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"os/signal"
1212
"time"
1313

14+
bearer "github.com/Bearer/bearer-go"
1415
"github.com/cayleygraph/cayley"
1516
"github.com/cayleygraph/cayley/graph"
1617
_ "github.com/cayleygraph/cayley/graph/kv/bolt"
@@ -32,10 +33,11 @@ var (
3233
logger *zap.Logger
3334
schemaConfig *schema.Config
3435

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

4042
airtableFlags = flag.NewFlagSet("airtable", flag.ExitOnError)
4143
airtableToken = airtableFlags.String("token", "", "airtable token")
@@ -105,6 +107,7 @@ func main() {
105107
}, {
106108
Name: "store",
107109
ShortHelp: "manage the data store",
110+
Options: []ff.Option{ff.WithEnvVarNoPrefix()},
108111
Subcommands: []*ffcli.Command{
109112
{Name: "dump-quads", Exec: execStoreDumpQuads},
110113
{Name: "dump-json", Exec: execStoreDumpJSON},
@@ -142,6 +145,10 @@ func main() {
142145
func globalPreRun() error {
143146
rand.Seed(srand.Secure())
144147

148+
if *globalBearerSecretKey != "" {
149+
bearer.ReplaceGlobals(bearer.Init(*globalBearerSecretKey))
150+
}
151+
145152
config := zap.NewDevelopmentConfig()
146153
config.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
147154
if *globalDebug {

go.mod

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.sum

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)