HTTP Basic Authentication support. Close #8

This commit is contained in:
mattn 2015-08-20 15:40:38 +09:00
parent 937c570039
commit 791e1e22cb
2 changed files with 46 additions and 3 deletions

View file

@ -32,6 +32,11 @@ func main() {
Usage: "Permit clients to write to the TTY (BE CAREFUL)",
EnvVar: "GOTTY_PERMIT_WRITE",
},
cli.StringFlag{
Name: "credential, c",
Usage: "Credential for Basic Authentication (ex: user:pass)",
EnvVar: "GOTTY_CREDENTIAL",
},
}
cmd.Action = func(c *cli.Context) {
if len(c.Args()) == 0 {
@ -39,7 +44,7 @@ func main() {
cli.ShowAppHelp(c)
os.Exit(1)
}
app := app.New(c.String("addr"), c.String("port"), c.Bool("permit-write"), c.Args())
app := app.New(c.String("addr"), c.String("port"), c.Bool("permit-write"), c.String("credential"), c.Args())
err := app.Run()
if err != nil {
fmt.Println(err)