mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
configure public key and related license variables at build time (#22202)
Instead of being completely hardcoded, public key is now set at build time according to build tag (test key if `testlicensekey` tag is passed to go build, production key otherwise). A `isProdLicensePublicKey` is also available for determining if the prod license key is being used. It is needed for choosing whether to point to production or test environment CWS. The test license key and CWS url values in this value are set to production values in this PR, but will be updated to the test values once we are ready to do the necessary updates to test environment spinwicks.
This commit is contained in:
11
Makefile
11
Makefile
@@ -33,6 +33,10 @@ IS_CI ?= false
|
||||
BUILD_NUMBER ?= $(BUILD_NUMBER:)
|
||||
BUILD_DATE = $(shell date -u)
|
||||
BUILD_HASH = $(shell git rev-parse HEAD)
|
||||
|
||||
# Go tags
|
||||
GOTAGS ?= $(GOTAGS:)
|
||||
|
||||
# If we don't set the build number it defaults to dev
|
||||
ifeq ($(BUILD_NUMBER),)
|
||||
BUILD_DATE := n/a
|
||||
@@ -41,6 +45,7 @@ endif
|
||||
|
||||
ifeq ($(BUILD_NUMBER),dev)
|
||||
export MM_FEATUREFLAGS_GRAPHQL = true
|
||||
GOTAGS += "testlicensekey"
|
||||
endif
|
||||
|
||||
# Enterprise
|
||||
@@ -600,7 +605,7 @@ run-server: setup-go-work prepackaged-binaries validate-go-version start-docker
|
||||
@echo Running mattermost for development
|
||||
|
||||
mkdir -p $(BUILD_WEBAPP_DIR)/dist/files
|
||||
$(GO) run $(GOFLAGS) -ldflags '$(LDFLAGS)' $(PLATFORM_FILES) $(RUN_IN_BACKGROUND)
|
||||
$(GO) run $(GOFLAGS) -tags $(GOTAGS) -ldflags '$(LDFLAGS)' $(PLATFORM_FILES) $(RUN_IN_BACKGROUND)
|
||||
|
||||
debug-server: start-docker ## Compile and start server using delve.
|
||||
mkdir -p $(BUILD_WEBAPP_DIR)/dist/files
|
||||
@@ -624,7 +629,7 @@ run-cli: start-docker ## Runs CLI.
|
||||
@echo Running mattermost for development
|
||||
@echo Example should be like 'make ARGS="-version" run-cli'
|
||||
|
||||
$(GO) run $(GOFLAGS) -ldflags '$(LDFLAGS)' $(PLATFORM_FILES) ${ARGS}
|
||||
$(GO) run $(GOFLAGS) -tags $(GOTAGS) -ldflags '$(LDFLAGS)' $(PLATFORM_FILES) ${ARGS}
|
||||
|
||||
run-client: ## Runs the webapp.
|
||||
@echo Running mattermost client for development
|
||||
@@ -681,7 +686,7 @@ restart-client: | stop-client run-client ## Restarts the webapp.
|
||||
|
||||
run-job-server: ## Runs the background job server.
|
||||
@echo Running job server for development
|
||||
$(GO) run $(GOFLAGS) -ldflags '$(LDFLAGS)' $(PLATFORM_FILES) jobserver &
|
||||
$(GO) run $(GOFLAGS) -tags $(GOTAGS) -ldflags '$(LDFLAGS)' $(PLATFORM_FILES) jobserver &
|
||||
|
||||
config-ldap: ## Configures LDAP.
|
||||
@echo Setting up configuration for local LDAP
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v6/app/platform"
|
||||
"github.com/mattermost/mattermost-server/v6/einterfaces/mocks"
|
||||
"github.com/mattermost/mattermost-server/v6/model"
|
||||
"github.com/mattermost/mattermost-server/v6/utils"
|
||||
@@ -264,11 +263,11 @@ func TestRequestTrialLicense(t *testing.T) {
|
||||
licenseManagerMock := &mocks.LicenseInterface{}
|
||||
licenseManagerMock.On("CanStartTrial").Return(true, nil).Once()
|
||||
th.App.Srv().Platform().SetLicenseManager(licenseManagerMock)
|
||||
|
||||
originalCwsUrl := *th.App.Srv().Config().CloudSettings.CWSURL
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.CloudSettings.CWSURL = testServer.URL })
|
||||
defer func(requestTrialURL string) {
|
||||
platform.RequestTrialURL = requestTrialURL
|
||||
}(platform.RequestTrialURL)
|
||||
platform.RequestTrialURL = testServer.URL
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.CloudSettings.CWSURL = requestTrialURL })
|
||||
}(originalCwsUrl)
|
||||
|
||||
resp, err := th.SystemAdminClient.RequestTrialLicense(nUsers)
|
||||
CheckErrorID(t, err, "api.license.add_license.unique_users.app_error")
|
||||
@@ -295,10 +294,11 @@ func TestRequestTrialLicense(t *testing.T) {
|
||||
licenseManagerMock.On("CanStartTrial").Return(true, nil).Once()
|
||||
th.App.Srv().Platform().SetLicenseManager(licenseManagerMock)
|
||||
|
||||
originalCwsUrl := *th.App.Srv().Config().CloudSettings.CWSURL
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.CloudSettings.CWSURL = testServer.URL })
|
||||
defer func(requestTrialURL string) {
|
||||
platform.RequestTrialURL = requestTrialURL
|
||||
}(platform.RequestTrialURL)
|
||||
platform.RequestTrialURL = testServer.URL
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.CloudSettings.CWSURL = requestTrialURL })
|
||||
}(originalCwsUrl)
|
||||
|
||||
resp, err := th.SystemAdminClient.RequestTrialLicense(nUsers)
|
||||
require.Error(t, err)
|
||||
|
||||
@@ -16,13 +16,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
LicenseEnv = "MM_LICENSE"
|
||||
LicenseRenewalURL = "https://customers.mattermost.com/subscribe/renew"
|
||||
JWTDefaultTokenExpiration = 7 * 24 * time.Hour // 7 days of expiration
|
||||
)
|
||||
|
||||
var RequestTrialURL = "https://customers.mattermost.com/api/v1/trials"
|
||||
|
||||
// ensure the license service wrapper implements `product.LicenseService`
|
||||
var _ product.LicenseService = (*licenseWrapper)(nil)
|
||||
|
||||
|
||||
@@ -23,14 +23,9 @@ import (
|
||||
|
||||
const (
|
||||
LicenseEnv = "MM_LICENSE"
|
||||
LicenseRenewalURL = "https://customers.mattermost.com/subscribe/renew"
|
||||
JWTDefaultTokenExpiration = 7 * 24 * time.Hour // 7 days of expiration
|
||||
)
|
||||
|
||||
var (
|
||||
RequestTrialURL = "https://customers.mattermost.com/api/v1/trials"
|
||||
)
|
||||
|
||||
// JWTClaims custom JWT claims with the needed information for the
|
||||
// renewal process
|
||||
type JWTClaims struct {
|
||||
@@ -302,7 +297,7 @@ func (ps *PlatformService) RequestTrialLicense(trialRequest *model.TrialLicenseR
|
||||
return model.NewAppError("RequestTrialLicense", "api.unmarshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
resp, err := http.Post(RequestTrialURL, "application/json", bytes.NewBuffer(trialRequestJSON))
|
||||
resp, err := http.Post(ps.getRequestTrialURL(), "application/json", bytes.NewBuffer(trialRequestJSON))
|
||||
if err != nil {
|
||||
return model.NewAppError("RequestTrialLicense", "api.license.request_trial_license.app_error", nil, "", http.StatusBadRequest).Wrap(err)
|
||||
}
|
||||
@@ -379,6 +374,13 @@ func (ps *PlatformService) GenerateLicenseRenewalLink() (string, string, *model.
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
renewalLink := LicenseRenewalURL + "?token=" + renewalToken
|
||||
return renewalLink, renewalToken, nil
|
||||
return fmt.Sprintf("%s?token=%s", ps.getLicenseRenewalURL(), renewalToken), renewalToken, nil
|
||||
}
|
||||
|
||||
func (ps *PlatformService) getLicenseRenewalURL() string {
|
||||
return fmt.Sprintf("%s/subscribe/renew", *ps.Config().CloudSettings.CWSURL)
|
||||
}
|
||||
|
||||
func (ps *PlatformService) getRequestTrialURL() string {
|
||||
return fmt.Sprintf("%s/api/v1/trials", *ps.Config().CloudSettings.CWSURL)
|
||||
}
|
||||
|
||||
@@ -5,85 +5,85 @@ build-linux: build-linux-amd64 build-linux-arm64
|
||||
build-linux-amd64:
|
||||
@echo Build Linux amd64
|
||||
ifeq ($(BUILDER_GOOS_GOARCH),"linux_amd64")
|
||||
env GOOS=linux GOARCH=amd64 $(GO) build -o $(GOBIN) $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./...
|
||||
env GOOS=linux GOARCH=amd64 $(GO) build -o $(GOBIN) $(GOFLAGS) -trimpath -tags '$(GOTAGS)' -ldflags '$(LDFLAGS)' ./...
|
||||
else
|
||||
mkdir -p $(GOBIN)/linux_amd64
|
||||
env GOOS=linux GOARCH=amd64 $(GO) build -o $(GOBIN)/linux_amd64 $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./...
|
||||
env GOOS=linux GOARCH=amd64 $(GO) build -o $(GOBIN)/linux_amd64 $(GOFLAGS) -trimpath -tags '$(GOTAGS)' -ldflags '$(LDFLAGS)' ./...
|
||||
endif
|
||||
|
||||
build-linux-arm64:
|
||||
@echo Build Linux arm64
|
||||
ifeq ($(BUILDER_GOOS_GOARCH),"linux_arm64")
|
||||
env GOOS=linux GOARCH=arm64 $(GO) build -o $(GOBIN) $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./...
|
||||
env GOOS=linux GOARCH=arm64 $(GO) build -o $(GOBIN) $(GOFLAGS) -trimpath -tags '$(GOTAGS)' -ldflags '$(LDFLAGS)' ./...
|
||||
else
|
||||
mkdir -p $(GOBIN)/linux_arm64
|
||||
env GOOS=linux GOARCH=arm64 $(GO) build -o $(GOBIN)/linux_arm64 $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./...
|
||||
env GOOS=linux GOARCH=arm64 $(GO) build -o $(GOBIN)/linux_arm64 $(GOFLAGS) -trimpath -tags '$(GOTAGS)' -ldflags '$(LDFLAGS)' ./...
|
||||
endif
|
||||
|
||||
build-osx:
|
||||
@echo Build OSX amd64
|
||||
ifeq ($(BUILDER_GOOS_GOARCH),"darwin_amd64")
|
||||
env GOOS=darwin GOARCH=amd64 $(GO) build -o $(GOBIN) $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./...
|
||||
env GOOS=darwin GOARCH=amd64 $(GO) build -o $(GOBIN) $(GOFLAGS) -trimpath -tags '$(GOTAGS)' -ldflags '$(LDFLAGS)' ./...
|
||||
else
|
||||
mkdir -p $(GOBIN)/darwin_amd64
|
||||
env GOOS=darwin GOARCH=amd64 $(GO) build -o $(GOBIN)/darwin_amd64 $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./...
|
||||
env GOOS=darwin GOARCH=amd64 $(GO) build -o $(GOBIN)/darwin_amd64 $(GOFLAGS) -trimpath -tags '$(GOTAGS)' -ldflags '$(LDFLAGS)' ./...
|
||||
endif
|
||||
@echo Build OSX arm64
|
||||
ifeq ($(BUILDER_GOOS_GOARCH),"darwin_arm64")
|
||||
env GOOS=darwin GOARCH=arm64 $(GO) build -o $(GOBIN) $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./...
|
||||
env GOOS=darwin GOARCH=arm64 $(GO) build -o $(GOBIN) $(GOFLAGS) -trimpath -tags '$(GOTAGS)' -ldflags '$(LDFLAGS)' ./...
|
||||
else
|
||||
mkdir -p $(GOBIN)/darwin_arm64
|
||||
env GOOS=darwin GOARCH=arm64 $(GO) build -o $(GOBIN)/darwin_arm64 $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./...
|
||||
env GOOS=darwin GOARCH=arm64 $(GO) build -o $(GOBIN)/darwin_arm64 $(GOFLAGS) -trimpath -tags '$(GOTAGS)' -ldflags '$(LDFLAGS)' ./...
|
||||
endif
|
||||
|
||||
build-windows:
|
||||
@echo Build Windows amd64
|
||||
ifeq ($(BUILDER_GOOS_GOARCH),"windows_amd64")
|
||||
env GOOS=windows GOARCH=amd64 $(GO) build -o $(GOBIN) $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./...
|
||||
env GOOS=windows GOARCH=amd64 $(GO) build -o $(GOBIN) $(GOFLAGS) -trimpath -tags '$(GOTAGS)' -ldflags '$(LDFLAGS)' ./...
|
||||
else
|
||||
mkdir -p $(GOBIN)/windows_amd64
|
||||
env GOOS=windows GOARCH=amd64 $(GO) build -o $(GOBIN)/windows_amd64 $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./...
|
||||
env GOOS=windows GOARCH=amd64 $(GO) build -o $(GOBIN)/windows_amd64 $(GOFLAGS) -trimpath -tags '$(GOTAGS)' -ldflags '$(LDFLAGS)' ./...
|
||||
endif
|
||||
|
||||
build-cmd-linux:
|
||||
@echo Build CMD Linux amd64
|
||||
ifeq ($(BUILDER_GOOS_GOARCH),"linux_amd64")
|
||||
env GOOS=linux GOARCH=amd64 $(GO) build -o $(GOBIN) $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./cmd/...
|
||||
env GOOS=linux GOARCH=amd64 $(GO) build -o $(GOBIN) $(GOFLAGS) -trimpath -tags '$(GOTAGS)' -ldflags '$(LDFLAGS)' ./cmd/...
|
||||
else
|
||||
mkdir -p $(GOBIN)/linux_amd64
|
||||
env GOOS=linux GOARCH=amd64 $(GO) build -o $(GOBIN)/linux_amd64 $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./cmd/...
|
||||
env GOOS=linux GOARCH=amd64 $(GO) build -o $(GOBIN)/linux_amd64 $(GOFLAGS) -trimpath -tags '$(GOTAGS)' -ldflags '$(LDFLAGS)' ./cmd/...
|
||||
endif
|
||||
@echo Build CMD Linux arm64
|
||||
ifeq ($(BUILDER_GOOS_GOARCH),"linux_arm64")
|
||||
env GOOS=linux GOARCH=arm64 $(GO) build -o $(GOBIN) $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./cmd/...
|
||||
env GOOS=linux GOARCH=arm64 $(GO) build -o $(GOBIN) $(GOFLAGS) -trimpath -tags '$(GOTAGS)' -ldflags '$(LDFLAGS)' ./cmd/...
|
||||
else
|
||||
mkdir -p $(GOBIN)/linux_arm64
|
||||
env GOOS=linux GOARCH=arm64 $(GO) build -o $(GOBIN)/linux_arm64 $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./cmd/...
|
||||
env GOOS=linux GOARCH=arm64 $(GO) build -o $(GOBIN)/linux_arm64 $(GOFLAGS) -trimpath -tags '$(GOTAGS)' -ldflags '$(LDFLAGS)' ./cmd/...
|
||||
endif
|
||||
|
||||
build-cmd-osx:
|
||||
@echo Build CMD OSX amd64
|
||||
ifeq ($(BUILDER_GOOS_GOARCH),"darwin_amd64")
|
||||
env GOOS=darwin GOARCH=amd64 $(GO) build -o $(GOBIN) $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./cmd/...
|
||||
env GOOS=darwin GOARCH=amd64 $(GO) build -o $(GOBIN) $(GOFLAGS) -trimpath -tags '$(GOTAGS)' -ldflags '$(LDFLAGS)' ./cmd/...
|
||||
else
|
||||
mkdir -p $(GOBIN)/darwin_amd64
|
||||
env GOOS=darwin GOARCH=amd64 $(GO) build -o $(GOBIN)/darwin_amd64 $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./cmd/...
|
||||
env GOOS=darwin GOARCH=amd64 $(GO) build -o $(GOBIN)/darwin_amd64 $(GOFLAGS) -trimpath -tags '$(GOTAGS)' -ldflags '$(LDFLAGS)' ./cmd/...
|
||||
endif
|
||||
@echo Build CMD OSX arm64
|
||||
ifeq ($(BUILDER_GOOS_GOARCH),"darwin_arm64")
|
||||
env GOOS=darwin GOARCH=arm64 $(GO) build -o $(GOBIN) $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./cmd/...
|
||||
env GOOS=darwin GOARCH=arm64 $(GO) build -o $(GOBIN) $(GOFLAGS) -trimpath -tags '$(GOTAGS)' -ldflags '$(LDFLAGS)' ./cmd/...
|
||||
else
|
||||
mkdir -p $(GOBIN)/darwin_arm64
|
||||
env GOOS=darwin GOARCH=arm64 $(GO) build -o $(GOBIN)/darwin_arm64 $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./cmd/...
|
||||
env GOOS=darwin GOARCH=arm64 $(GO) build -o $(GOBIN)/darwin_arm64 $(GOFLAGS) -trimpath -tags '$(GOTAGS)' -ldflags '$(LDFLAGS)' ./cmd/...
|
||||
endif
|
||||
|
||||
build-cmd-windows:
|
||||
@echo Build CMD Windows amd64
|
||||
ifeq ($(BUILDER_GOOS_GOARCH),"windows_amd64")
|
||||
env GOOS=windows GOARCH=amd64 $(GO) build -o $(GOBIN) $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./cmd/...
|
||||
env GOOS=windows GOARCH=amd64 $(GO) build -o $(GOBIN) $(GOFLAGS) -trimpath -tags '$(GOTAGS)' -ldflags '$(LDFLAGS)' ./cmd/...
|
||||
else
|
||||
mkdir -p $(GOBIN)/windows_amd64
|
||||
env GOOS=windows GOARCH=amd64 $(GO) build -o $(GOBIN)/windows_amd64 $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./cmd/...
|
||||
env GOOS=windows GOARCH=amd64 $(GO) build -o $(GOBIN)/windows_amd64 $(GOFLAGS) -trimpath -tags '$(GOTAGS)' -ldflags '$(LDFLAGS)' ./cmd/...
|
||||
endif
|
||||
|
||||
build: setup-go-work build-linux build-windows build-osx
|
||||
|
||||
@@ -241,7 +241,12 @@ const (
|
||||
|
||||
CloudSettingsDefaultCwsURL = "https://customers.mattermost.com"
|
||||
CloudSettingsDefaultCwsAPIURL = "https://portal.internal.prod.cloud.mattermost.com"
|
||||
OpenidSettingsDefaultScope = "profile openid email"
|
||||
// TODO: update to "https://portal.test.cloud.mattermost.com" when ready to use test license key
|
||||
CloudSettingsDefaultCwsURLTest = "https://customers.mattermost.com"
|
||||
// TODO: update to // "https://api.internal.test.cloud.mattermost.com" when ready to use test license key
|
||||
CloudSettingsDefaultCwsAPIURLTest = "https://portal.internal.prod.cloud.mattermost.com"
|
||||
|
||||
OpenidSettingsDefaultScope = "profile openid email"
|
||||
|
||||
LocalModeSocketPath = "/var/tmp/mattermost_local.socket"
|
||||
)
|
||||
@@ -2781,9 +2786,15 @@ type CloudSettings struct {
|
||||
func (s *CloudSettings) SetDefaults() {
|
||||
if s.CWSURL == nil {
|
||||
s.CWSURL = NewString(CloudSettingsDefaultCwsURL)
|
||||
if !isProdLicensePublicKey {
|
||||
s.CWSURL = NewString(CloudSettingsDefaultCwsURLTest)
|
||||
}
|
||||
}
|
||||
if s.CWSAPIURL == nil {
|
||||
s.CWSAPIURL = NewString(CloudSettingsDefaultCwsAPIURL)
|
||||
if !isProdLicensePublicKey {
|
||||
s.CWSAPIURL = NewString(CloudSettingsDefaultCwsAPIURLTest)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
7
model/license_key.go
Normal file
7
model/license_key.go
Normal file
@@ -0,0 +1,7 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
//go:build !testlicensekey
|
||||
|
||||
package model
|
||||
|
||||
const isProdLicensePublicKey = true
|
||||
7
model/license_key_test_env.go
Normal file
7
model/license_key_test_env.go
Normal file
@@ -0,0 +1,7 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
//go:build testlicensekey
|
||||
|
||||
package model
|
||||
|
||||
const isProdLicensePublicKey = false
|
||||
9
utils/license-public-key-test.txt
Normal file
9
utils/license-public-key-test.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyZmShlU8Z8HdG0IWSZ8r
|
||||
tSyzyxrXkJjsFUf0Ke7bm/TLtIggRdqOcUF3XEWqQk5RGD5vuq7Rlg1zZqMEBk8N
|
||||
EZeRhkxyaZW8pLjxwuBUOnXfJew31+gsTNdKZzRjrvPumKr3EtkleuoxNdoatu4E
|
||||
HrKmR/4Yi71EqAvkhk7ZjQFuF0osSWJMEEGGCSUYQnTEqUzcZSh1BhVpkIkeu8Kk
|
||||
1wCtptODixvEujgqVe+SrE3UlZjBmPjC/CL+3cYmufpSNgcEJm2mwsdaXp2OPpfn
|
||||
a0v85XL6i9ote2P+fLZ3wX9EoioHzgdgB7arOxY50QRJO7OyCqpKFKv6lRWTXuSt
|
||||
hwIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
9
utils/license-public-key.txt
Normal file
9
utils/license-public-key.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyZmShlU8Z8HdG0IWSZ8r
|
||||
tSyzyxrXkJjsFUf0Ke7bm/TLtIggRdqOcUF3XEWqQk5RGD5vuq7Rlg1zZqMEBk8N
|
||||
EZeRhkxyaZW8pLjxwuBUOnXfJew31+gsTNdKZzRjrvPumKr3EtkleuoxNdoatu4E
|
||||
HrKmR/4Yi71EqAvkhk7ZjQFuF0osSWJMEEGGCSUYQnTEqUzcZSh1BhVpkIkeu8Kk
|
||||
1wCtptODixvEujgqVe+SrE3UlZjBmPjC/CL+3cYmufpSNgcEJm2mwsdaXp2OPpfn
|
||||
a0v85XL6i9ote2P+fLZ3wX9EoioHzgdgB7arOxY50QRJO7OyCqpKFKv6lRWTXuSt
|
||||
hwIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
@@ -22,16 +22,6 @@ import (
|
||||
"github.com/mattermost/mattermost-server/v6/utils/fileutils"
|
||||
)
|
||||
|
||||
var publicKey []byte = []byte(`-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyZmShlU8Z8HdG0IWSZ8r
|
||||
tSyzyxrXkJjsFUf0Ke7bm/TLtIggRdqOcUF3XEWqQk5RGD5vuq7Rlg1zZqMEBk8N
|
||||
EZeRhkxyaZW8pLjxwuBUOnXfJew31+gsTNdKZzRjrvPumKr3EtkleuoxNdoatu4E
|
||||
HrKmR/4Yi71EqAvkhk7ZjQFuF0osSWJMEEGGCSUYQnTEqUzcZSh1BhVpkIkeu8Kk
|
||||
1wCtptODixvEujgqVe+SrE3UlZjBmPjC/CL+3cYmufpSNgcEJm2mwsdaXp2OPpfn
|
||||
a0v85XL6i9ote2P+fLZ3wX9EoioHzgdgB7arOxY50QRJO7OyCqpKFKv6lRWTXuSt
|
||||
hwIDAQAB
|
||||
-----END PUBLIC KEY-----`)
|
||||
|
||||
var LicenseValidator LicenseValidatorIface
|
||||
|
||||
func init() {
|
||||
|
||||
10
utils/license_public_key.go
Normal file
10
utils/license_public_key.go
Normal file
@@ -0,0 +1,10 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
//go:build !testlicensekey
|
||||
|
||||
package utils
|
||||
|
||||
import _ "embed"
|
||||
|
||||
//go:embed license-public-key.txt
|
||||
var publicKey []byte
|
||||
13
utils/license_public_key_test_env.go
Normal file
13
utils/license_public_key_test_env.go
Normal file
@@ -0,0 +1,13 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
//go:build testlicensekey
|
||||
|
||||
package utils
|
||||
|
||||
import _ "embed"
|
||||
|
||||
// TODO: license-public-key-test.txt currently has the contents of the prod public key.
|
||||
// Change to the test public key when ready for dev images to use test license key.
|
||||
|
||||
//go:embed license-public-key-test.txt
|
||||
var publicKey []byte
|
||||
Reference in New Issue
Block a user