From 5db884ece2146dc19865833950493a20416add48 Mon Sep 17 00:00:00 2001 From: Pranav Singh Date: Wed, 27 Nov 2024 21:24:43 +0530 Subject: [PATCH 1/2] fix env usuage Signed-off-by: Pranav Singh --- .github/.goreleaser.yml | 4 ++-- cmd/kanvas-snapshot/cmd.go | 5 ++++- main.go | 8 +++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/.goreleaser.yml b/.github/.goreleaser.yml index e2ea6aa9ea..db703e5655 100644 --- a/.github/.goreleaser.yml +++ b/.github/.goreleaser.yml @@ -10,8 +10,8 @@ builds: ldflags: - -s -w - -X main.providerToken={{.Env.PROVIDER_TOKEN}} - - -X main.MesheryCloudAPIBaseURL="https://cloud.layer5.io" - - -X main.MesheryAPIBaseURL="https://playground.meshery.io" + - -X main.mesheryCloudAPIBaseURL="https://cloud.layer5.io" + - -X main.mesheryAPIBaseURL="https://playground.meshery.io" goos: - linux - darwin diff --git a/cmd/kanvas-snapshot/cmd.go b/cmd/kanvas-snapshot/cmd.go index 0d0988173a..2775f838e3 100644 --- a/cmd/kanvas-snapshot/cmd.go +++ b/cmd/kanvas-snapshot/cmd.go @@ -263,7 +263,10 @@ func isValidEmail(email string) bool { return emailRegex.MatchString(email) } -func Main() { +func Main(providerToken, mesheryCloudAPIBaseURL, mesheryAPIBaseURL string) { + ProviderToken = providerToken + MesheryCloudAPIBaseURL = mesheryCloudAPIBaseURL + MesheryAPIBaseURL = mesheryAPIBaseURL generateKanvasSnapshotCmd.Flags().StringVarP(&chartURI, "file", "f", "", "URI to Helm chart (required)") generateKanvasSnapshotCmd.Flags().StringVarP(&designName, "design-name", "n", "", "Optional name for the Meshery design") generateKanvasSnapshotCmd.Flags().StringVarP(&email, "email", "e", "", "Optional email to associate with the Meshery design") diff --git a/main.go b/main.go index ea24cb7621..d07d760778 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,12 @@ import ( cmd "github.com/meshery/helm-kanvas-snapshot/cmd/kanvas-snapshot" ) +var ( + providerToken string + mesheryCloudAPIBaseURL string + mesheryAPIBaseURL string +) + func main() { - cmd.Main() + cmd.Main(providerToken, mesheryCloudAPIBaseURL, mesheryAPIBaseURL) } From 09a748e8ca5443d8e32553f7387b186299ad7e1d Mon Sep 17 00:00:00 2001 From: Pranav Singh Date: Wed, 27 Nov 2024 21:25:04 +0530 Subject: [PATCH 2/2] gofmt Signed-off-by: Pranav Singh --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index d07d760778..55482e17ab 100644 --- a/main.go +++ b/main.go @@ -5,9 +5,9 @@ import ( ) var ( - providerToken string + providerToken string mesheryCloudAPIBaseURL string - mesheryAPIBaseURL string + mesheryAPIBaseURL string ) func main() {