mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #301 in YUNIONIO/onecloud from ~QIUJIAN/onecloud:feature/qj-enable-http-tls to release/2.2.0
* commit '575ea95525aea075b1ae8b542151185ee4ba14c5': 改进:允许climc指定tls证书,允许服务指定tls证书
This commit is contained in:
+10
-2
@@ -22,6 +22,14 @@ func InitApp(options *Options) *appsrv.Application {
|
||||
|
||||
func ServeForever(app *appsrv.Application, options *Options) {
|
||||
addr := net.JoinHostPort(options.Address, strconv.Itoa(options.Port))
|
||||
log.Infof("Start listen on %s", addr)
|
||||
app.ListenAndServe(addr)
|
||||
proto := "http"
|
||||
if options.EnableSsl {
|
||||
proto = "https"
|
||||
}
|
||||
log.Infof("Start listen on %s://%s", proto, addr)
|
||||
if options.EnableSsl {
|
||||
app.ListenAndServeTLS(addr, options.SslCertfile, options.SslKeyfile)
|
||||
} else {
|
||||
app.ListenAndServe(addr)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ func InitAuth(options *Options, authComplete auth.AuthCompletedCallback) {
|
||||
|
||||
// debug := options.LogLevel == "debug"
|
||||
|
||||
auth.Init(a, false, true) // , authComplete)
|
||||
auth.Init(a, false, true, options.SslCertfile, options.SslKeyfile) // , authComplete)
|
||||
|
||||
authComplete()
|
||||
}
|
||||
|
||||
@@ -36,6 +36,10 @@ type Options struct {
|
||||
GlobalVirtualResourceNamespace bool `help:"Per project namespace or global namespace for virtual resources"`
|
||||
DebugSqlchemy bool `default:"False" help:"Print SQL executed by sqlchemy"`
|
||||
|
||||
EnableSsl bool `help:"Enable https"`
|
||||
SslCertfile string `help:"ssl certification file"`
|
||||
SslKeyfile string `help:"ssl certification key file"`
|
||||
|
||||
structarg.BaseOptions
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user