fix(security): fix http basic auth debug warning; cleanup

This commit is contained in:
eternal-flame-AD 2018-09-03 21:25:07 +08:00
parent 77a8946115
commit 94414d5f59
No known key found for this signature in database
GPG Key ID: 4CBBC48C2F2FF36B
3 changed files with 4 additions and 17 deletions

View File

@ -2,9 +2,7 @@ package main
import (
"bytes"
"errors"
"flag"
"fmt"
"os"
"strconv"
@ -22,19 +20,6 @@ type Config struct {
AuthenticationParam *string
}
type authFlag struct {
selectedMethod auth.Method
}
func (c authFlag) Set(arg string) error {
fmt.Println(arg)
return errors.New("fall")
}
func (c authFlag) String() string {
return "test"
}
var config = &Config{
ListenAddr: flag.String("listen", getEnv("LISTEN_ADDR", ":8080"), "HTTP service address (e.g.address, ':8080')"),
NbWorkers: flag.Int("nb-workers", getIntEnv("NB_WORKERS", 2), "The number of workers to start"),

View File

@ -18,7 +18,9 @@ type basicAuth struct {
func (c *basicAuth) Init(debug bool) {
c.debug = debug
logger.Warning.Println("\u001B[33mBasic Auth: Debug mode enabled. Might Leak sentitive information in log output.\u001B[0m")
if debug {
logger.Warning.Println("\u001B[33mBasic Auth: Debug mode enabled. Might Leak sentitive information in log output.\u001B[0m")
}
}
func (c *basicAuth) Usage() string {

View File

@ -8,7 +8,7 @@ type noAuth struct {
}
func (c *noAuth) Usage() string {
return "No Auth. Usage: --auth none"
return "No Auth. Usage: -auth none"
}
func (c *noAuth) Init(_ bool) {}