本文整理汇总了Golang中github.com/vulcand/vulcand/Godeps/_workspace/src/github.com/codegangsta/cli.Context.Bool方法的典型用法代码示例。如果您正苦于以下问题:Golang Context.Bool方法的具体用法?Golang Context.Bool怎么用?Golang Context.Bool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/vulcand/vulcand/Godeps/_workspace/src/github.com/codegangsta/cli.Context
的用法示例。
在下文中一共展示了Context.Bool方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: upsertHostAction
func (cmd *Command) upsertHostAction(c *cli.Context) {
host, err := engine.NewHost(c.String("name"), engine.HostSettings{})
if err != nil {
cmd.printError(err)
return
}
if c.String("cert") != "" || c.String("privateKey") != "" {
keyPair, err := readKeyPair(c.String("cert"), c.String("privateKey"))
if err != nil {
cmd.printError(fmt.Errorf("failed to read key pair: %s", err))
return
}
host.Settings.KeyPair = keyPair
}
host.Settings.OCSP = engine.OCSPSettings{
Enabled: c.Bool("ocsp"),
SkipSignatureCheck: c.Bool("ocspSkipCheck"),
Period: c.Duration("ocspPeriod").String(),
Responders: c.StringSlice("ocspResponder"),
}
if err := cmd.client.UpsertHost(*host); err != nil {
cmd.printError(err)
return
}
cmd.printOk("host added")
}
示例2: getFrontendSettings
func getFrontendSettings(c *cli.Context) (engine.HTTPFrontendSettings, error) {
s := engine.HTTPFrontendSettings{}
s.Limits.MaxMemBodyBytes = int64(c.Int("maxMemBodyKB") * 1024)
s.Limits.MaxBodyBytes = int64(c.Int("maxBodyKB") * 1024)
s.FailoverPredicate = c.String("failoverPredicate")
s.Hostname = c.String("forwardHost")
s.TrustForwardHeader = c.Bool("trustForwardHeader")
s.PassHostHeader = c.Bool("passHostHeader")
return s, nil
}
示例3: getTLSSettings
func getTLSSettings(c *cli.Context) (*engine.TLSSettings, error) {
s := &engine.TLSSettings{
InsecureSkipVerify: c.Bool("tlsSkipVerify"),
PreferServerCipherSuites: c.Bool("tlsPreferServerCS"),
SessionTicketsDisabled: c.Bool("tlsSessionTicketsOff"),
MinVersion: c.String("tlsMinV"),
MaxVersion: c.String("tlsMaxV"),
CipherSuites: c.StringSlice("tlsCS"),
}
s.SessionCache.Type = c.String("tlsSessionCache")
if s.SessionCache.Type == engine.LRUCacheType {
s.SessionCache.Settings = &engine.LRUSessionCacheSettings{
Capacity: c.Int("tlsSessionCacheCapacity"),
}
}
if _, err := engine.NewTLSConfig(s); err != nil {
return nil, err
}
return s, nil
}
示例4: FromCli
func FromCli(c *cli.Context) (plugin.Middleware, error) {
return NewRewrite(c.String("regexp"), c.String("replacement"), c.Bool("rewriteBody"), c.Bool("redirect"))
}