mirror of
https://github.com/certimate-go/certimate.git
synced 2026-10-29 17:58:19 +08:00
28 lines
986 B
Go
28 lines
986 B
Go
package deployers
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/certimate-go/certimate/internal/domain"
|
|
"github.com/certimate-go/certimate/pkg/core"
|
|
upyunfile "github.com/certimate-go/certimate/pkg/core/ssl-deployer/providers/upyun-file"
|
|
xmaps "github.com/certimate-go/certimate/pkg/utils/maps"
|
|
)
|
|
|
|
func init() {
|
|
Registries.MustRegister(domain.DeploymentProviderTypeUpyunFile, func(options *ProviderFactoryOptions) (core.SSLDeployer, error) {
|
|
credentials := domain.AccessConfigForUpyun{}
|
|
if err := xmaps.Populate(options.ProviderAccessConfig, &credentials); err != nil {
|
|
return nil, fmt.Errorf("failed to populate provider access config: %w", err)
|
|
}
|
|
|
|
provider, err := upyunfile.NewSSLDeployerProvider(&upyunfile.SSLDeployerProviderConfig{
|
|
Username: credentials.Username,
|
|
Password: credentials.Password,
|
|
Bucket: xmaps.GetString(options.ProviderExtendedConfig, "bucket"),
|
|
Domain: xmaps.GetString(options.ProviderExtendedConfig, "domain"),
|
|
})
|
|
return provider, err
|
|
})
|
|
}
|