Skip to content

Commit 2a324ee

Browse files
committed
Allow password to be specified via environment variable for auth-user plugin
1 parent 0293b26 commit 2a324ee

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cmd/plugin-auth-user/main.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@ package main
22

33
import (
44
"flag"
5+
"os"
6+
57
"github.com/grepplabs/kafka-proxy/plugin/local-auth/shared"
68
"github.com/hashicorp/go-plugin"
79
"github.com/sirupsen/logrus"
8-
"os"
910
)
1011

12+
const EnvSaslPassword = "SASL_PASSWORD"
13+
1114
type PasswordAuthenticator struct {
1215
Username string
1316
Password string
@@ -29,6 +32,11 @@ func main() {
2932
passwordAuthenticator := &PasswordAuthenticator{}
3033
flags := passwordAuthenticator.flagSet()
3134
flags.Parse(os.Args[1:])
35+
36+
if passwordAuthenticator.Password == "" {
37+
passwordAuthenticator.Password = os.Getenv(EnvSaslPassword)
38+
}
39+
3240
if passwordAuthenticator.Username == "" || passwordAuthenticator.Password == "" {
3341
logrus.Errorf("parameters username and password are required")
3442
os.Exit(1)

0 commit comments

Comments
 (0)