mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2026-02-07 21:45:37 +08:00
[SSL证书]实现基本的自动申请证书流程
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user