feat: add cdnfly deployer

This commit is contained in:
Fu Diwei
2025-02-18 15:14:24 +08:00
parent 46f02331fd
commit 03d2f4ca32
122 changed files with 955 additions and 243 deletions

View File

@@ -30,11 +30,11 @@ func New(config *CacheFlyDeployerConfig) (*CacheFlyDeployer, error) {
func NewWithLogger(config *CacheFlyDeployerConfig, logger logger.Logger) (*CacheFlyDeployer, error) {
if config == nil {
return nil, errors.New("config is nil")
panic("config is nil")
}
if logger == nil {
return nil, errors.New("logger is nil")
panic("logger is nil")
}
client, err := createSdkClient(config.ApiToken)
@@ -66,6 +66,10 @@ func (d *CacheFlyDeployer) Deploy(ctx context.Context, certPem string, privkeyPe
}
func createSdkClient(apiToken string) (*cfsdk.Client, error) {
if apiToken == "" {
return nil, errors.New("invalid cachefly api token")
}
client := cfsdk.NewClient(apiToken)
return client, nil
}

View File

@@ -31,7 +31,7 @@ Shell command to run this test:
go test -v ./cachefly_test.go -args \
--CERTIMATE_DEPLOYER_CACHEFLY_INPUTCERTPATH="/path/to/your-input-cert.pem" \
--CERTIMATE_DEPLOYER_CACHEFLY_INPUTKEYPATH="/path/to/your-input-key.pem" \
--CERTIMATE_DEPLOYER_CACHEFLY_APITOKEN="your-baota-panel-key"
--CERTIMATE_DEPLOYER_CACHEFLY_APITOKEN="your-api-token"
*/
func TestDeploy(t *testing.T) {
flag.Parse()