mirror of
https://github.com/yudai/gotty.git
synced 2026-01-03 08:08:50 +01:00
HTTP Basic Authentication support. Close #8
This commit is contained in:
parent
937c570039
commit
791e1e22cb
2 changed files with 46 additions and 3 deletions
7
main.go
7
main.go
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue