From c41cf0a0be976c0ab85bf21ad02a7c289368af9a Mon Sep 17 00:00:00 2001 From: eeisegn Date: Tue, 10 Oct 2023 10:27:41 +0100 Subject: [PATCH] change from int to boolean --- CHANGELOG.md | 5 +++++ pkg/cmd/server.go | 2 +- pkg/config/server_config.go | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33dddf7..c825db7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Upcoming changes... +## [1.3.3] - 2023-10-10 +### Changed +- Changed option to enable/disable file_url reporting (`FileContents`) from integer to boolean + ## [1.3.2] - 2023-10-03 ### Added - Added option to enable/disable file_url reporting (`FileContents`) @@ -88,3 +92,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [1.3.0]: https://github.com/scanoss/api.go/compare/v1.2.3...v1.3.0 [1.3.1]: https://github.com/scanoss/api.go/compare/v1.3.0...v1.3.1 [1.3.2]: https://github.com/scanoss/api.go/compare/v1.3.1...v1.3.2 +[1.3.3]: https://github.com/scanoss/api.go/compare/v1.3.2...v1.3.3 diff --git a/pkg/cmd/server.go b/pkg/cmd/server.go index c5f9bbb..7fc44c3 100644 --- a/pkg/cmd/server.go +++ b/pkg/cmd/server.go @@ -84,7 +84,7 @@ func setupEnvVars(cfg *myconfig.ServerConfig) { if err != nil { zlog.S.Infof("Failed to set SCANOSS_FILE_CONTENTS SCANOSS_API_URL value to %v: %v", cfg.Scanning.FileContents, err) } - if customContents := os.Getenv("SCANOSS_FILE_CONTENTS"); len(customContents) > 0 && customContents == "0" { + if customContents := os.Getenv("SCANOSS_FILE_CONTENTS"); len(customContents) > 0 && customContents == "false" { zlog.S.Infof("Skipping file_url datafield.") } } diff --git a/pkg/config/server_config.go b/pkg/config/server_config.go index 80138a9..e88db27 100644 --- a/pkg/config/server_config.go +++ b/pkg/config/server_config.go @@ -65,7 +65,7 @@ type ServerConfig struct { KeepFailedWfps bool `env:"SCAN_KEEP_FAILED_WFP"` // true/false ScanningURL string `env:"SCANOSS_API_URL"` // URL to present back in API responses - default https://osskb.org/api HPSMEnabled bool `env:"SCAN_HPSM_ENABLED"` // Enable HPSM (High Precision Snippet Matching) or not (default true) - FileContents int `env:"SCANOSS_FILE_CONTENTS"` // Show matched file URL in scan results (default 1 - enabled, 0 - disabled) + FileContents bool `env:"SCANOSS_FILE_CONTENTS"` // Show matched file URL in scan results (default true) } TLS struct { CertFile string `env:"SCAN_TLS_CERT"` // TLS Certificate @@ -112,7 +112,7 @@ func setServerConfigDefaults(cfg *ServerConfig) { cfg.Scanning.HPSMEnabled = true cfg.Telemetry.Enabled = false cfg.Telemetry.OltpExporter = "0.0.0.0:4317" // Default OTEL OLTP gRPC Exporter endpoint - cfg.Scanning.FileContents = 1 // Matched File URL response enabled (1) by default + cfg.Scanning.FileContents = true // Matched File URL response enabled (true) by default } // LoadFile loads the specified file and returns its contents in a string array.