mirror of
https://github.com/openrport/openrport.git
synced 2025-10-26 11:27:11 +00:00
Initial version with armed license checking
This commit is contained in:
parent
6728b7fbcd
commit
c7ca4bd768
4
Makefile
4
Makefile
@ -6,10 +6,10 @@ BINARIES=rport rportd
|
||||
all: test build lint
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 $(foreach BINARY,$(BINARIES),go build -ldflags "-s -w" -o $(BINARY) -v ./cmd/$(BINARY)/...;)
|
||||
CGO_ENABLED=0 $(foreach BINARY,$(BINARIES),go build -ldflags "-s -w" -o $(BINARY) -v ./cmd/$(BINARY);)
|
||||
|
||||
build-debug:
|
||||
$(foreach BINARY,$(BINARIES),go build -race -gcflags "all=-N -l" -o $(BINARY) -v ./cmd/$(BINARY)/...;)
|
||||
$(foreach BINARY,$(BINARIES),go build -race -gcflags "all=-N -l" -o $(BINARY) -v ./cmd/$(BINARY);)
|
||||
|
||||
test:
|
||||
go test -race -v ./...
|
||||
|
||||
1
go.mod
1
go.mod
@ -76,7 +76,6 @@ require (
|
||||
github.com/pkg/sftp v1.13.4
|
||||
github.com/shirou/gopsutil/v3 v3.22.12
|
||||
github.com/trustelem/zxcvbn v1.0.1
|
||||
golang.org/x/exp v0.0.0-20230321023759-10a507213a29
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
2
go.sum
2
go.sum
@ -500,8 +500,6 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
|
||||
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug=
|
||||
golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
|
||||
@ -5,6 +5,4 @@ type Config struct {
|
||||
Key string `mapstructure:"key"`
|
||||
ProxyURL string `mapstructure:"proxy_url"`
|
||||
DataDir string // the main rportd data_dir is used
|
||||
// TODO: (rs): remove this now?
|
||||
CheckingEnabled bool // allow license checking to be disabled/enabled. will be removed for 1.0.
|
||||
}
|
||||
|
||||
@ -10,7 +10,6 @@ import (
|
||||
licensecap "github.com/realvnc-labs/rport/plus/capabilities/license"
|
||||
"github.com/realvnc-labs/rport/plus/capabilities/oauth"
|
||||
"github.com/realvnc-labs/rport/plus/capabilities/status"
|
||||
"github.com/realvnc-labs/rport/plus/license"
|
||||
"github.com/realvnc-labs/rport/server/chconfig"
|
||||
"github.com/realvnc-labs/rport/share/files"
|
||||
"github.com/realvnc-labs/rport/share/logger"
|
||||
@ -31,17 +30,6 @@ func EnablePlusIfLicensed(ctx context.Context, cfg *chconfig.Config, filesAPI fi
|
||||
return nil, ErrPlusNotEnabled
|
||||
}
|
||||
|
||||
// If plus is enabled then ensure license checking is disabled until release 1.0
|
||||
if rportplus.IsPlusEnabled(cfg.PlusConfig) {
|
||||
if !rportplus.HasLicenseConfig(cfg.PlusConfig) {
|
||||
cfg.PlusConfig.LicenseConfig = &license.Config{
|
||||
CheckingEnabled: false,
|
||||
}
|
||||
} else {
|
||||
cfg.PlusConfig.LicenseConfig.CheckingEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
if !rportplus.HasLicenseConfig(cfg.PlusConfig) {
|
||||
logger.Errorf(ErrPlusLicenseNotConfigured.Error())
|
||||
return nil, ErrPlusLicenseNotConfigured
|
||||
|
||||
@ -25,7 +25,7 @@ func Run(ctx context.Context, log *logger.Logger, task Task, interval time.Durat
|
||||
log.Debugf("finished")
|
||||
case <-ctx.Done():
|
||||
tick.Stop()
|
||||
log.Debugf("context canceled", task)
|
||||
log.Debugf("context canceled")
|
||||
log.Debugf("stopped")
|
||||
return
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user