feat: added separate username and password flags
This commit is contained in:
parent
6f89e66306
commit
d89de33d06
1 changed files with 5 additions and 1 deletions
6
main.go
6
main.go
|
@ -35,6 +35,8 @@ var (
|
|||
logRequest = flag.Bool("enable-logging", false, "Enable log request. NOTE: Deprecated, set log-level to debug to log all requests")
|
||||
httpsPromote = flag.Bool("https-promote", false, "All HTTP requests should be redirected to HTTPS")
|
||||
headerConfigPath = flag.String("header-config-path", "/config/headerConfig.json", "Path to the config file for custom response headers")
|
||||
basicAuthUser = flag.String("basic-auth-user", "", "Username for basic auth")
|
||||
basicAuthPass = flag.String("basic-auth-pass", "", "Password for basic auth")
|
||||
|
||||
username string
|
||||
password string
|
||||
|
@ -159,7 +161,9 @@ func main() {
|
|||
|
||||
if *basicAuth {
|
||||
log.Debug().Msg("Enabling Basic Auth")
|
||||
if len(*setBasicAuth) != 0 {
|
||||
if len(*basicAuthUser) != 0 && len(*basicAuthPass) != 0 {
|
||||
parseAuth(*basicAuthUser + ":" + *basicAuthPass)
|
||||
} else if len(*setBasicAuth) != 0 {
|
||||
parseAuth(*setBasicAuth)
|
||||
} else {
|
||||
generateRandomAuth()
|
||||
|
|
Loading…
Reference in a new issue