fix api broken
This commit is contained in:
parent
35d49d3b34
commit
e030109b5a
8 changed files with 59 additions and 12 deletions
12
cmd/cert.go
12
cmd/cert.go
|
@ -32,12 +32,12 @@ var CmdCert = cli.Command{
|
||||||
Outputs to 'cert.pem' and 'key.pem' and will overwrite existing files.`,
|
Outputs to 'cert.pem' and 'key.pem' and will overwrite existing files.`,
|
||||||
Action: runCert,
|
Action: runCert,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
cli.StringFlag{"host", "", "Comma-separated hostnames and IPs to generate a certificate for", ""},
|
stringFlag("host", "", "Comma-separated hostnames and IPs to generate a certificate for"),
|
||||||
cli.StringFlag{"ecdsa-curve", "", "ECDSA curve to use to generate a key. Valid values are P224, P256, P384, P521", ""},
|
stringFlag("ecdsa-curve", "", "ECDSA curve to use to generate a key. Valid values are P224, P256, P384, P521"),
|
||||||
cli.IntFlag{"rsa-bits", 2048, "Size of RSA key to generate. Ignored if --ecdsa-curve is set", ""},
|
intFlag("rsa-bits", 2048, "Size of RSA key to generate. Ignored if --ecdsa-curve is set"),
|
||||||
cli.StringFlag{"start-date", "", "Creation date formatted as Jan 1 15:04:05 2011", ""},
|
stringFlag("start-date", "", "Creation date formatted as Jan 1 15:04:05 2011"),
|
||||||
cli.DurationFlag{"duration", 365 * 24 * time.Hour, "Duration that certificate is valid for", ""},
|
durationFlag("duration", 365*24*time.Hour, "Duration that certificate is valid for"),
|
||||||
cli.BoolFlag{"ca", "whether this cert should be its own Certificate Authority", ""},
|
boolFlag("ca", "whether this cert should be its own Certificate Authority"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
42
cmd/cmd.go
Normal file
42
cmd/cmd.go
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
// Copyright 2015 The Gogs Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/codegangsta/cli"
|
||||||
|
)
|
||||||
|
|
||||||
|
func stringFlag(name, value, usage string) cli.StringFlag {
|
||||||
|
return cli.StringFlag{
|
||||||
|
Name: name,
|
||||||
|
Value: value,
|
||||||
|
Usage: usage,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func boolFlag(name, usage string) cli.BoolFlag {
|
||||||
|
return cli.BoolFlag{
|
||||||
|
Name: name,
|
||||||
|
Usage: usage,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func intFlag(name string, value int, usage string) cli.IntFlag {
|
||||||
|
return cli.IntFlag{
|
||||||
|
Name: name,
|
||||||
|
Value: value,
|
||||||
|
Usage: usage,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func durationFlag(name string, value time.Duration, usage string) cli.DurationFlag {
|
||||||
|
return cli.DurationFlag{
|
||||||
|
Name: name,
|
||||||
|
Value: value,
|
||||||
|
Usage: usage,
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,8 +25,8 @@ var CmdDump = cli.Command{
|
||||||
It can be used for backup and capture Gogs server image to send to maintainer`,
|
It can be used for backup and capture Gogs server image to send to maintainer`,
|
||||||
Action: runDump,
|
Action: runDump,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
|
stringFlag("config, c", "custom/conf/app.ini", "Custom configuration file path"),
|
||||||
cli.BoolFlag{"verbose, v", "show process details", ""},
|
boolFlag("verbose, v", "show process details"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ var CmdServ = cli.Command{
|
||||||
Description: `Serv provide access auth for repositories`,
|
Description: `Serv provide access auth for repositories`,
|
||||||
Action: runServ,
|
Action: runServ,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
|
stringFlag("config, c", "custom/conf/app.ini", "Custom configuration file path"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ var CmdUpdate = cli.Command{
|
||||||
Description: `Update get pushed info and insert into database`,
|
Description: `Update get pushed info and insert into database`,
|
||||||
Action: runUpdate,
|
Action: runUpdate,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
|
stringFlag("config, c", "custom/conf/app.ini", "Custom configuration file path"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,8 +56,8 @@ var CmdWeb = cli.Command{
|
||||||
and it takes care of all the other things for you`,
|
and it takes care of all the other things for you`,
|
||||||
Action: runWeb,
|
Action: runWeb,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
cli.StringFlag{"port, p", "3000", "Temporary port number to prevent conflict", ""},
|
stringFlag("port, p", "3000", "Temporary port number to prevent conflict"),
|
||||||
cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
|
stringFlag("config, c", "custom/conf/app.ini", "Custom configuration file path"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -418,6 +418,10 @@ func CommitRepoAction(
|
||||||
isNewBranch = true
|
isNewBranch = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: limit to detect latest 100 commits.
|
||||||
|
if len(commit.Commits) > 100 {
|
||||||
|
commit.Commits = commit.Commits[len(commit.Commits)-100:]
|
||||||
|
}
|
||||||
if err = updateIssuesCommit(u, repo, repoUserName, repoName, commit.Commits); err != nil {
|
if err = updateIssuesCommit(u, repo, repoUserName, repoName, commit.Commits); err != nil {
|
||||||
log.Error(4, "updateIssuesCommit: %v", err)
|
log.Error(4, "updateIssuesCommit: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,7 @@ func handleServerConn(keyID string, chans <-chan ssh.NewChannel) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: check timeout
|
||||||
if err = cmd.Start(); err != nil {
|
if err = cmd.Start(); err != nil {
|
||||||
log.Error(3, "Start: %v", err)
|
log.Error(3, "Start: %v", err)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue