Skip to content

Commit

Permalink
replace meshery cookir with provider token
Browse files Browse the repository at this point in the history
Signed-off-by: Eti Ijeoma <ijayeti@gmail.com>
  • Loading branch information
Aijeyomah committed Oct 7, 2024
1 parent bd6383b commit d7f6ee3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 24 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/build-and-release-snapshot-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_CHANNEL: "stable"
MESHERY_CLOUD_API_COOKIE: ${{ secrets.MESHERY_CLOUD_API_COOKIE }}
MESHERY_API_COOKIE: ${{ secrets.MESHERY_API_COOKIE }}
MESHERY_CLOUD_API_BASE_URL: ${{ secrets.MESHERY_CLOUD_API_BASE_URL }}
MESHERY_API_BASE_URL: ${{ secrets.MESHERY_API_BASE_URL }}
SYSTEM_ID: ${{ secrets.SYSTEM_ID }}
PROVIDER_TOKEN: ${{ secrets.PROVIDER_TOKEN }}

with:
version: '~> v2'
args: release --clean --skip-validate
8 changes: 3 additions & 5 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ builds:

ldflags:
- -s -w
- -X main.MesheryCloudApiCookie={{.Env.MESHERY_CLOUD_API_COOKIE}}
- -X main.MesheryApiCookie={{.Env.MESHERY_API_COOKIE}}
- -X main.MesheryCloudApiBaseUrl={{.Env.MESHERY_CLOUD_API_BASE_URL}}
- -X main.MesheryApiBaseUrl={{.Env.MESHERY_API_BASE_URL}}
- -X main.SystemID={{.Env.SYSTEM_ID}}
- -X main.providerToken=${{ .Env.PROVIDER_TOKEN }}
- -X main.MesheryCloudApiBaseUrl="https://meshery.layer5.io"
- -X main.MesheryApiBaseUrl="https://playground.meshery.io"

goos:
- darwin
Expand Down
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,9 @@ BINNAME_WINDOWS ?= kanvas-snapshot-windows-$(ARCH).exe


LDFLAGS := "\
-X 'main.MesheryCloudApiCookie=$(MESHERY_CLOUD_API_COOKIES)' \
-X 'main.MesheryApiCookie=$(MESHERY_API_COOKIES)' \
-X 'main.providerToken=$(PROVIDER_TOKEN)' \
-X 'main.MesheryCloudApiBaseUrl=$(MESHERY_CLOUD_API_BASE_URL)' \
-X 'main.MesheryApiBaseUrl=$(MESHERY_API_BASE_URL)' \
-X 'main.SystemID=$(SYSTEM_ID)'"
-X 'main.MesheryApiBaseUrl=$(MESHERY_API_BASE_URL)'"

.PHONY: build
build:
Expand Down
4 changes: 1 addition & 3 deletions build/Makefile.core.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
GOVERSION = 1.23
MESHERY_API_COOKIE=""
MESHERY_CLOUD_API_COOKIE=""
PROVIDER_TOKEN=""
MESHERY_CLOUD_API_BASE_URL="http://localhost:9876"
MESHERY_API_BASE_URL="http://localhost:3000"
SYSTEM_ID="ad8acecd-b742-4958-9af9-538c4183a177"
10 changes: 3 additions & 7 deletions cmd/kanvas-snapshot/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@ import (
)

var (
MesheryToken string
MesheryCloudApiCookie string
MesheryApiCookie string
ProviderToken string
MesheryApiBaseUrl string
MesheryCloudApiBaseUrl string
SystemID string
Log logger.Handler
)

Expand Down Expand Up @@ -165,7 +162,7 @@ func CreateMesheryDesign(uri, name, email string) (string, error) {
}

// Set headers and log them
req.Header.Set("Cookie", MesheryApiCookie)
req.Header.Set("Cookie", ProviderToken)
req.Header.Set("Origin", MesheryApiBaseUrl)
req.Header.Set("Host", MesheryApiBaseUrl)
req.Header.Set("Content-Type", "text/plain;charset=UTF-8")
Expand Down Expand Up @@ -231,9 +228,8 @@ func GenerateSnapshot(designID, chartURI, email, assetLocation string) error {
return err
}

req.Header.Set("Cookie", MesheryCloudApiCookie)
req.Header.Set("Cookie", ProviderToken)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("SystemID", SystemID)
req.Header.Set("Referer", fmt.Sprintf("%s/dashboard", MesheryCloudApiBaseUrl))

client := &http.Client{}
Expand Down

0 comments on commit d7f6ee3

Please sign in to comment.