From f7cf214c08f32b807af5d40c339f142369f82b93 Mon Sep 17 00:00:00 2001 From: Benedikt Kulmann Date: Wed, 27 May 2020 15:36:40 +0200 Subject: [PATCH] Add JWTSecret to config and flagset --- pkg/config/config.go | 22 ++++++++++++++-------- pkg/flagset/flagset.go | 7 +++++++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 4af870147..2479925ef 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -47,16 +47,22 @@ type Storage struct { RootMountPath string } +// TokenManager is the config for using the reva token manager +type TokenManager struct { + JWTSecret string +} + // Config combines all available configuration parts. type Config struct { - File string - Storage Storage - Log Log - Debug Debug - HTTP HTTP - GRPC GRPC - Tracing Tracing - Asset Asset + File string + Storage Storage + Log Log + Debug Debug + HTTP HTTP + GRPC GRPC + Tracing Tracing + Asset Asset + TokenManager TokenManager } // New initializes a new configuration with or without defaults. diff --git a/pkg/flagset/flagset.go b/pkg/flagset/flagset.go index 508e3ad4a..ed14961b0 100644 --- a/pkg/flagset/flagset.go +++ b/pkg/flagset/flagset.go @@ -163,5 +163,12 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag { EnvVars: []string{"SETTINGS_ROOT_MOUNT_PATH"}, Destination: &cfg.Storage.RootMountPath, }, + &cli.StringFlag{ + Name: "jwt-secret", + Value: "Pive-Fumkiu4", + Usage: "Used to create JWT to talk to reva, should equal reva's jwt-secret", + EnvVars: []string{"SETTINGS_JWT_SECRET"}, + Destination: &cfg.TokenManager.JWTSecret, + }, } }