[SSL证书]实现基本的自动申请证书流程

This commit is contained in:
刘祥超
2020-11-26 16:39:01 +08:00
parent c2d22fb4fb
commit 564f137877
8 changed files with 70 additions and 14 deletions

View File

@@ -2,14 +2,26 @@ package acme
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"time"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
type RunAction struct {
actionutils.ParentAction
}
func (this *RunAction) RunPost(params struct{}) {
time.Sleep(5 * time.Second) // TODO
this.Success()
func (this *RunAction) RunPost(params struct {
TaskId int64
}) {
runResp, err := this.RPC().ACMETaskRPC().RunACMETask(this.AdminContext(), &pb.RunACMETaskRequest{AcmeTaskId: params.TaskId})
if err != nil {
this.ErrorPage(err)
return
}
if runResp.IsOk {
this.Data["certId"] = runResp.SslCertId
this.Success()
} else {
this.Fail(runResp.Error)
}
}