mirror of https://github.com/allinssl/allinssl
后端代码同步
parent
5124663aab
commit
312f10d06d
|
@ -37,8 +37,9 @@ func Deploy(cfg map[string]any, logger *public.Logger) error {
|
|||
case "aliyun-cdn":
|
||||
logger.Debug("部署到阿里云CDN...")
|
||||
return DeployAliCdn(cfg)
|
||||
// case "aliyun-oss":
|
||||
|
||||
case "aliyun-oss":
|
||||
logger.Debug("部署到阿里云OSS...")
|
||||
return DeployOss(cfg)
|
||||
default:
|
||||
return fmt.Errorf("不支持的部署: %s", providerName)
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ type SSHConfig struct {
|
|||
Password string // 可选
|
||||
PrivateKey string // 可选
|
||||
Host string
|
||||
Port string
|
||||
Port float64
|
||||
}
|
||||
|
||||
type RemoteFile struct {
|
||||
|
@ -45,7 +45,7 @@ func buildAuthMethods(password, privateKey string) ([]ssh.AuthMethod, error) {
|
|||
}
|
||||
|
||||
func writeMultipleFilesViaSSH(config SSHConfig, files []RemoteFile, preCmd, postCmd string) error {
|
||||
addr := fmt.Sprintf("%s:%s", config.Host, config.Port)
|
||||
addr := fmt.Sprintf("%s:%d", config.Host, int(config.Port))
|
||||
|
||||
authMethods, err := buildAuthMethods(config.Password, config.PrivateKey)
|
||||
if err != nil {
|
||||
|
@ -127,7 +127,7 @@ func DeploySSH(cfg map[string]any) error {
|
|||
if !ok {
|
||||
return fmt.Errorf("参数错误:keyPath")
|
||||
}
|
||||
certPath, ok := cfg["keyPath"].(string)
|
||||
certPath, ok := cfg["certPath"].(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("参数错误:certPath")
|
||||
}
|
||||
|
@ -155,8 +155,8 @@ func DeploySSH(cfg map[string]any) error {
|
|||
}
|
||||
// 自动创建多级目录
|
||||
files := []RemoteFile{
|
||||
{Path: keyPath, Content: certPem},
|
||||
{Path: certPath, Content: keyPem},
|
||||
{Path: certPath, Content: certPem},
|
||||
{Path: keyPath, Content: keyPem},
|
||||
}
|
||||
err = writeMultipleFilesViaSSH(providerConfig, files, beforeCmd, afterCmd)
|
||||
if err != nil {
|
||||
|
|
|
@ -98,10 +98,12 @@ func Save(setting *Setting) error {
|
|||
if setting.Timeout != 0 {
|
||||
s.Where("key = 'timeout'", []interface{}{}).Update(map[string]interface{}{"value": setting.Timeout})
|
||||
public.TimeOut = setting.Timeout
|
||||
restart = true
|
||||
}
|
||||
if setting.Secure != "" {
|
||||
s.Where("key = 'secure'", []interface{}{}).Update(map[string]interface{}{"value": setting.Secure})
|
||||
public.TimeOut = setting.Timeout
|
||||
restart = true
|
||||
}
|
||||
if setting.Https == "1" {
|
||||
if setting.Key == "" || setting.Cert == "" {
|
||||
|
@ -122,7 +124,6 @@ func Save(setting *Setting) error {
|
|||
os.WriteFile("data/https/cert.pem", []byte(setting.Cert), 0644)
|
||||
restart = true
|
||||
}
|
||||
|
||||
if restart {
|
||||
Restart()
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue