完善 Scert 前后端与部署支持
This commit is contained in:
1 parent
afdb947bea
commit
7f0af703ed
85 files changed
+7530
-800
No files matched your search
@@ -116,6 +116,12 @@ func NewWithConfigPath(ctx context.Context, cfg config.Config, configPath string
|
||||
result, err := workflow.DeployCurrent(ctx, domainID)
|
||||
return result.Certificate, result.Deployment, err
|
||||
},
|
||||
RestoreCertificateVersion: func(ctx context.Context, domainID, version string) (certificate.IssueResult, error) {
|
||||
return certificates.RestoreVersion(ctx, domainID, version)
|
||||
},
|
||||
RunRenewal: func(ctx context.Context) (certificate.RenewalReport, error) {
|
||||
return renewal.RunOnce(ctx)
|
||||
},
|
||||
CurrentCertificate: certificates,
|
||||
ResetStatePath: admin.StatePath(cfg.Paths.Data),
|
||||
Audit: auditRepo,
|
||||
@@ -123,7 +129,9 @@ func NewWithConfigPath(ctx context.Context, cfg config.Config, configPath string
|
||||
})
|
||||
return &App{
|
||||
Config: cfg, Logger: logger, Database: db, Repository: repo,
|
||||
Servers: serverRepo,
|
||||
Tasks: taskRepo,
|
||||
Deployment: deploymentService,
|
||||
SecretStore: secretStore, SSHKeys: sshKeys, DNSVerification: dnsVerification, HTTP: server,
|
||||
Certificates: certificates,
|
||||
Workflow: workflow,
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"git.pcux.cn/xuans/Scert/backend/internal/config"
|
||||
)
|
||||
|
||||
func TestNewWiresApplicationServices(t *testing.T) {
|
||||
baseDir := t.TempDir()
|
||||
cfg := config.Default(baseDir)
|
||||
application, err := NewWithConfigPath(context.Background(), cfg, filepath.Join(cfg.Paths.Config, "scert.json"))
|
||||
if err != nil {
|
||||
t.Fatalf("初始化应用失败:%v", err)
|
||||
}
|
||||
defer application.Close()
|
||||
|
||||
if application.Repository == nil || application.Servers == nil || application.Tasks == nil {
|
||||
t.Fatal("数据库仓储未完整注入应用实例")
|
||||
}
|
||||
if application.Deployment == nil || application.Certificates == nil || application.Workflow == nil || application.Renewal == nil {
|
||||
t.Fatal("证书申请、部署或续期服务未完整注入应用实例")
|
||||
}
|
||||
if application.SecretStore == nil || application.SSHKeys == nil || application.DNSVerification == nil || application.HTTP == nil {
|
||||
t.Fatal("敏感信息、SSH、DNS 或 HTTP 服务未完整注入应用实例")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user