Update query parameter and make HTTPS by default #4
11
main.go
11
main.go
|
@ -21,6 +21,7 @@ var (
|
|||
gpg string
|
||||
display bool
|
||||
ssh bool
|
||||
insecure bool
|
||||
debug bool
|
||||
)
|
||||
|
||||
|
@ -66,13 +67,17 @@ func main() {
|
|||
Usage: "GPG key to sign with",
|
||||
Destination: &gpg,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "insecure",
|
||||
Usage: "Use HTTP instead of HTTPS by default",
|
||||
Destination: &insecure,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "debug",
|
||||
Usage: "Enable debug logging",
|
||||
Destination: &debug,
|
||||
},
|
||||
}
|
||||
app.UseShortOptionHandling = true
|
||||
app.Action = doImport
|
||||
|
||||
if err := app.Run(os.Args); err != nil {
|
||||
|
@ -95,8 +100,12 @@ func doImport(ctx *cli.Context) error {
|
|||
return err
|
||||
}
|
||||
if u.Scheme == "" {
|
||||
u.Scheme = "https"
|
||||
if insecure {
|
||||
u.Scheme = "http"
|
||||
}
|
||||
}
|
||||
u.RawQuery = "git-import=1"
|
||||
|
||||
beaver.Debugf("Getting git-import from %s", u.String())
|
||||
res, err := http.Get(u.String())
|
||||
|
|
Loading…
Reference in New Issue