Skip to content

Commit 3d775cd

Browse files
committed
secret config
1 parent 305b7c6 commit 3d775cd

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

cmd/grpc/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func run() error {
3333
if err != nil {
3434
return errors.New(fmt.Sprintf("unable to listen to the port: %v", err))
3535
}
36-
tokenSvc := token.NewService(([]byte)("5555"), 3600)
36+
tokenSvc := token.NewService(([]byte)(config.Secret), 3600)
3737
authInterceptor := interceptor.NewAuthInterceptor(tokenSvc)
3838
server := grpc.NewServer(grpc.UnaryInterceptor(authInterceptor.Unary()))
3939
ctx := context.Background()

config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import "github.com/spf13/viper"
55
type GrpcConfig struct {
66
Port int `mapstructure:"port"`
77
DbConnectionString string `mapstructure:"connection"`
8+
Secret string `mapstructure:"secret"`
89
}
910

1011
type ProxyConfig struct {

config/grpc.config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
port = 8181
22
connection = "postgres://postgres:123456@localhost:5432/paotooong?sslmode=disable"
3+
secret = ""

0 commit comments

Comments
 (0)