From 622273b7461d051c284ebe8fa076e0db6716a3ac Mon Sep 17 00:00:00 2001 From: Robert Lin Date: Sat, 16 Jun 2018 14:01:27 -0700 Subject: [PATCH] Rename "Secret" to "WebHookSecret" --- cfg/remote.go | 6 +++--- client/client.go | 4 ++-- client/client_test.go | 8 ++++---- common/request.go | 2 +- daemon/inertiad/up.go | 2 +- input.go | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cfg/remote.go b/cfg/remote.go index d522a473..62cf49c5 100644 --- a/cfg/remote.go +++ b/cfg/remote.go @@ -13,9 +13,9 @@ type RemoteVPS struct { // DaemonConfig contains parameters for the Daemon type DaemonConfig struct { - Port string `toml:"port"` - Token string `toml:"token"` - Secret string `toml:"secret"` + Port string `toml:"port"` + Token string `toml:"token"` + WebHookSecret string `toml:"webhook_secret"` } // GetHost creates the user@IP string. diff --git a/client/client.go b/client/client.go index 7fb106be..2496a06b 100644 --- a/client/client.go +++ b/client/client.go @@ -99,7 +99,7 @@ func (c *Client) BootstrapRemote(repoName string) error { // Output Webhook url to user. println(">> GitHub WebHook URL (add to https://www.github.com/" + repoName + "/settings/hooks/new): ") println("WebHook Address: https://" + c.IP + ":" + c.Daemon.Port + "/webhook") - println("WebHook Secret: " + c.Daemon.Secret) + println("WebHook Secret: " + c.Daemon.WebHookSecret) println(`Note that you will have to disable SSH verification in your webhook settings - Inertia uses self-signed certificates that GitHub won't be able to verify.` + "\n") @@ -206,7 +206,7 @@ func (c *Client) Up(gitRemoteURL, buildType string, stream bool) (*http.Response Stream: stream, Project: c.project, BuildType: buildType, - Secret: c.RemoteVPS.Daemon.Secret, + WebHookSecret: c.RemoteVPS.Daemon.WebHookSecret, BuildFilePath: c.buildFilePath, GitOptions: &common.GitOptions{ RemoteURL: common.GetSSHRemoteURL(gitRemoteURL), diff --git a/client/client_test.go b/client/client_test.go index eb41e02b..db4cb514 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -39,9 +39,9 @@ func getMockClient(ts *httptest.Server) *Client { IP: url, PEM: "", Daemon: &cfg.DaemonConfig{ - Port: port, - Secret: "arjan", - Token: fakeAuth, + Port: port, + WebHookSecret: "arjan", + Token: fakeAuth, }, } @@ -211,7 +211,7 @@ func TestUp(t *testing.T) { err = json.Unmarshal(body, &upReq) assert.Nil(t, err) assert.Equal(t, "myremote.git", upReq.GitOptions.RemoteURL) - assert.Equal(t, "arjan", upReq.Secret) + assert.Equal(t, "arjan", upReq.WebHookSecret) assert.Equal(t, "test_project", upReq.Project) assert.Equal(t, "docker-compose", upReq.BuildType) diff --git a/common/request.go b/common/request.go index fbab5b0e..75802502 100644 --- a/common/request.go +++ b/common/request.go @@ -21,7 +21,7 @@ type UpRequest struct { BuildType string `json:"build_type"` BuildFilePath string `json:"build_file_path"` GitOptions *GitOptions `json:"git_options"` - Secret string `json:"webhook_secret"` + WebHookSecret string `json:"webhook_secret"` } // GitOptions represents GitHub-related deployment options diff --git a/daemon/inertiad/up.go b/daemon/inertiad/up.go index aed1fb7c..2f5537cd 100644 --- a/daemon/inertiad/up.go +++ b/daemon/inertiad/up.go @@ -38,7 +38,7 @@ func upHandler(w http.ResponseWriter, r *http.Request) { }) defer logger.Close() - webhookSecret = upReq.Secret + webhookSecret = upReq.WebHookSecret // Check for existing git repository, clone if no git repository exists. skipUpdate := false diff --git a/input.go b/input.go index 9934ab4f..125501ea 100644 --- a/input.go +++ b/input.go @@ -80,8 +80,8 @@ func addRemoteWalkthrough( Branch: branch, SSHPort: sshPort, Daemon: &cfg.DaemonConfig{ - Port: port, - Secret: secret, + Port: port, + WebHookSecret: secret, }, }) return nil