diff --git a/internal/pkg/core/deployer/providers/ratpanel-console/ratpanel_console.go b/internal/pkg/core/deployer/providers/ratpanel-console/ratpanel_console.go index ba9f5949..ceb31771 100644 --- a/internal/pkg/core/deployer/providers/ratpanel-console/ratpanel_console.go +++ b/internal/pkg/core/deployer/providers/ratpanel-console/ratpanel_console.go @@ -1,4 +1,4 @@ -package baotapanelconsole +package ratpanelconsole import ( "context" diff --git a/internal/pkg/core/deployer/providers/ratpanel-console/ratpanel_console_test.go b/internal/pkg/core/deployer/providers/ratpanel-console/ratpanel_console_test.go index 5f3845e4..6303aa25 100644 --- a/internal/pkg/core/deployer/providers/ratpanel-console/ratpanel_console_test.go +++ b/internal/pkg/core/deployer/providers/ratpanel-console/ratpanel_console_test.go @@ -1,4 +1,4 @@ -package baotapanelconsole_test +package ratpanelconsole_test import ( "context" @@ -8,33 +8,36 @@ import ( "strings" "testing" - provider "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/baotapanel-console" + provider "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/ratpanel-console" ) var ( fInputCertPath string fInputKeyPath string fApiUrl string - fApiKey string + fTokenId uint + fToken string ) func init() { - argsPrefix := "CERTIMATE_DEPLOYER_BAOTAPANELCONSOLE_" + argsPrefix := "CERTIMATE_DEPLOYER_RATPANELCONSOLE_" flag.StringVar(&fInputCertPath, argsPrefix+"INPUTCERTPATH", "", "") flag.StringVar(&fInputKeyPath, argsPrefix+"INPUTKEYPATH", "", "") flag.StringVar(&fApiUrl, argsPrefix+"APIURL", "", "") - flag.StringVar(&fApiKey, argsPrefix+"APIKEY", "", "") + flag.UintVar(&fTokenId, argsPrefix+"TOKENID", 0, "") + flag.StringVar(&fToken, argsPrefix+"TOKEN", "", "") } /* Shell command to run this test: go test -v ./baotapanel_console_test.go -args \ - --CERTIMATE_DEPLOYER_BAOTAPANELCONSOLE_INPUTCERTPATH="/path/to/your-input-cert.pem" \ - --CERTIMATE_DEPLOYER_BAOTAPANELCONSOLE_INPUTKEYPATH="/path/to/your-input-key.pem" \ - --CERTIMATE_DEPLOYER_BAOTAPANELCONSOLE_APIURL="http://127.0.0.1:8888" \ - --CERTIMATE_DEPLOYER_BAOTAPANELCONSOLE_APIKEY="your-api-key" + --CERTIMATE_DEPLOYER_RATPANELCONSOLE_INPUTCERTPATH="/path/to/your-input-cert.pem" \ + --CERTIMATE_DEPLOYER_RATPANELCONSOLE_INPUTKEYPATH="/path/to/your-input-key.pem" \ + --CERTIMATE_DEPLOYER_RATPANELCONSOLE_APIURL="http://127.0.0.1:8888" \ + --CERTIMATE_DEPLOYER_RATPANELSITE_TOKENID="your-access-token-id" \ + --CERTIMATE_DEPLOYER_RATPANELSITE_TOKEN="your-access-token" \ */ func TestDeploy(t *testing.T) { flag.Parse() @@ -45,14 +48,15 @@ func TestDeploy(t *testing.T) { fmt.Sprintf("INPUTCERTPATH: %v", fInputCertPath), fmt.Sprintf("INPUTKEYPATH: %v", fInputKeyPath), fmt.Sprintf("APIURL: %v", fApiUrl), - fmt.Sprintf("APIKEY: %v", fApiKey), + fmt.Sprintf("TOKENID: %v", fTokenId), + fmt.Sprintf("TOKEN: %v", fToken), }, "\n")) deployer, err := provider.NewDeployer(&provider.DeployerConfig{ ApiUrl: fApiUrl, - ApiKey: fApiKey, + AccessTokenId: fTokenId, + AccessToken: fToken, AllowInsecureConnections: true, - AutoRestart: true, }) if err != nil { t.Errorf("err: %+v", err) diff --git a/internal/pkg/core/deployer/providers/ratpanel-site/ratpanel_site.go b/internal/pkg/core/deployer/providers/ratpanel-site/ratpanel_site.go index 639470e1..85f54ab5 100644 --- a/internal/pkg/core/deployer/providers/ratpanel-site/ratpanel_site.go +++ b/internal/pkg/core/deployer/providers/ratpanel-site/ratpanel_site.go @@ -1,4 +1,4 @@ -package baotapanelsite +package ratpanelsite import ( "context" diff --git a/internal/pkg/core/deployer/providers/ratpanel-site/ratpanel_site_test.go b/internal/pkg/core/deployer/providers/ratpanel-site/ratpanel_site_test.go index 5fece978..86c22e1e 100644 --- a/internal/pkg/core/deployer/providers/ratpanel-site/ratpanel_site_test.go +++ b/internal/pkg/core/deployer/providers/ratpanel-site/ratpanel_site_test.go @@ -1,4 +1,4 @@ -package baotapanelsite_test +package ratpanelsite_test import ( "context" @@ -8,26 +8,26 @@ import ( "strings" "testing" - provider "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/baotapanel-site" + provider "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/ratpanel-site" ) var ( fInputCertPath string fInputKeyPath string fApiUrl string - fApiKey string - fSiteType string + fTokenId uint + fToken string fSiteName string ) func init() { - argsPrefix := "CERTIMATE_DEPLOYER_BAOTAPANELSITE_" + argsPrefix := "CERTIMATE_DEPLOYER_RATPANELSITE_" flag.StringVar(&fInputCertPath, argsPrefix+"INPUTCERTPATH", "", "") flag.StringVar(&fInputKeyPath, argsPrefix+"INPUTKEYPATH", "", "") flag.StringVar(&fApiUrl, argsPrefix+"APIURL", "", "") - flag.StringVar(&fApiKey, argsPrefix+"APIKEY", "", "") - flag.StringVar(&fSiteType, argsPrefix+"SITETYPE", "", "") + flag.UintVar(&fTokenId, argsPrefix+"TOKENID", 0, "") + flag.StringVar(&fToken, argsPrefix+"TOKEN", "", "") flag.StringVar(&fSiteName, argsPrefix+"SITENAME", "", "") } @@ -35,12 +35,12 @@ func init() { Shell command to run this test: go test -v ./baotapanel_site_test.go -args \ - --CERTIMATE_DEPLOYER_BAOTAPANELSITE_INPUTCERTPATH="/path/to/your-input-cert.pem" \ - --CERTIMATE_DEPLOYER_BAOTAPANELSITE_INPUTKEYPATH="/path/to/your-input-key.pem" \ - --CERTIMATE_DEPLOYER_BAOTAPANELSITE_APIURL="http://127.0.0.1:8888" \ - --CERTIMATE_DEPLOYER_BAOTAPANELSITE_APIKEY="your-api-key" \ - --CERTIMATE_DEPLOYER_BAOTAPANELSITE_SITETYPE="php" \ - --CERTIMATE_DEPLOYER_BAOTAPANELSITE_SITENAME="your-site-name" + --CERTIMATE_DEPLOYER_RATPANELSITE_INPUTCERTPATH="/path/to/your-input-cert.pem" \ + --CERTIMATE_DEPLOYER_RATPANELSITE_INPUTKEYPATH="/path/to/your-input-key.pem" \ + --CERTIMATE_DEPLOYER_RATPANELSITE_APIURL="http://127.0.0.1:8888" \ + --CERTIMATE_DEPLOYER_RATPANELSITE_TOKENID="your-access-token-id" \ + --CERTIMATE_DEPLOYER_RATPANELSITE_TOKEN="your-access-token" \ + --CERTIMATE_DEPLOYER_RATPANELSITE_SITENAME="your-site-name" */ func TestDeploy(t *testing.T) { flag.Parse() @@ -51,18 +51,17 @@ func TestDeploy(t *testing.T) { fmt.Sprintf("INPUTCERTPATH: %v", fInputCertPath), fmt.Sprintf("INPUTKEYPATH: %v", fInputKeyPath), fmt.Sprintf("APIURL: %v", fApiUrl), - fmt.Sprintf("APIKEY: %v", fApiKey), - fmt.Sprintf("SITETYPE: %v", fSiteType), + fmt.Sprintf("TOKENID: %v", fTokenId), + fmt.Sprintf("TOKEN: %v", fToken), fmt.Sprintf("SITENAME: %v", fSiteName), }, "\n")) deployer, err := provider.NewDeployer(&provider.DeployerConfig{ ApiUrl: fApiUrl, - ApiKey: fApiKey, + AccessTokenId: fTokenId, + AccessToken: fToken, AllowInsecureConnections: true, - SiteType: fSiteType, SiteName: fSiteName, - SiteNames: []string{fSiteName}, }) if err != nil { t.Errorf("err: %+v", err) diff --git a/internal/pkg/sdk3rd/ratpanel/api.go b/internal/pkg/sdk3rd/ratpanel/api.go index 764dd6bd..a2f15153 100644 --- a/internal/pkg/sdk3rd/ratpanel/api.go +++ b/internal/pkg/sdk3rd/ratpanel/api.go @@ -1,4 +1,4 @@ -package btpanelsdk +package ratpanelsdk import "net/http" diff --git a/internal/pkg/sdk3rd/ratpanel/client.go b/internal/pkg/sdk3rd/ratpanel/client.go index 2b2efdd2..e0562410 100644 --- a/internal/pkg/sdk3rd/ratpanel/client.go +++ b/internal/pkg/sdk3rd/ratpanel/client.go @@ -1,4 +1,4 @@ -package btpanelsdk +package ratpanelsdk import ( "bytes" diff --git a/internal/pkg/sdk3rd/ratpanel/models.go b/internal/pkg/sdk3rd/ratpanel/models.go index 2608300a..bf5f53fb 100644 --- a/internal/pkg/sdk3rd/ratpanel/models.go +++ b/internal/pkg/sdk3rd/ratpanel/models.go @@ -1,4 +1,4 @@ -package btpanelsdk +package ratpanelsdk type BaseResponse interface { GetMessage() string