mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-21 03:39:56 +00:00
fixed 1panel system ssl deploy
This commit is contained in:
parent
a048eb95a9
commit
9542079e20
@ -62,10 +62,15 @@ func (d *DeployerProvider) WithLogger(logger *slog.Logger) deployer.Deployer {
|
|||||||
|
|
||||||
func (d *DeployerProvider) Deploy(ctx context.Context, certPEM string, privkeyPEM string) (*deployer.DeployResult, error) {
|
func (d *DeployerProvider) Deploy(ctx context.Context, certPEM string, privkeyPEM string) (*deployer.DeployResult, error) {
|
||||||
// 设置面板 SSL 证书
|
// 设置面板 SSL 证书
|
||||||
|
SSLEnable := "enable"
|
||||||
|
if d.config.ApiVersion == "v2" {
|
||||||
|
SSLEnable = "Enable"
|
||||||
|
}
|
||||||
|
|
||||||
updateSystemSSLReq := &onepanelsdk.UpdateSystemSSLRequest{
|
updateSystemSSLReq := &onepanelsdk.UpdateSystemSSLRequest{
|
||||||
Cert: certPEM,
|
Cert: certPEM,
|
||||||
Key: privkeyPEM,
|
Key: privkeyPEM,
|
||||||
SSL: "enable",
|
SSL: SSLEnable,
|
||||||
SSLType: "import-paste",
|
SSLType: "import-paste",
|
||||||
}
|
}
|
||||||
if d.config.AutoRestart {
|
if d.config.AutoRestart {
|
||||||
|
@ -7,7 +7,13 @@ import (
|
|||||||
|
|
||||||
func (c *Client) UpdateSystemSSL(req *UpdateSystemSSLRequest) (*UpdateSystemSSLResponse, error) {
|
func (c *Client) UpdateSystemSSL(req *UpdateSystemSSLRequest) (*UpdateSystemSSLResponse, error) {
|
||||||
resp := &UpdateSystemSSLResponse{}
|
resp := &UpdateSystemSSLResponse{}
|
||||||
err := c.sendRequestWithResult(http.MethodPost, "/settings/ssl/update", req, resp)
|
|
||||||
|
path := "/settings/ssl/update"
|
||||||
|
if c.version == "v2" {
|
||||||
|
path = "/core" + path
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.sendRequestWithResult(http.MethodPost, path, req, resp)
|
||||||
return resp, err
|
return resp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Client struct {
|
type Client struct {
|
||||||
client *resty.Client
|
client *resty.Client
|
||||||
|
version string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewClient(serverUrl, apiVersion, apiKey string) *Client {
|
func NewClient(serverUrl, apiVersion, apiKey string) *Client {
|
||||||
@ -36,7 +37,8 @@ func NewClient(serverUrl, apiVersion, apiKey string) *Client {
|
|||||||
})
|
})
|
||||||
|
|
||||||
return &Client{
|
return &Client{
|
||||||
client: client,
|
client: client,
|
||||||
|
version: apiVersion,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user