From 99df470099a828567749a0c8d8d4147cb60b53bf Mon Sep 17 00:00:00 2001 From: Jamie Sinn Date: Mon, 7 Oct 2024 11:29:19 -0400 Subject: [PATCH] chore: Set default log file to empty string (#28) * Set default log file to empty string * update tests * update tests * remove from example config --- config.json.example | 2 +- options.go | 5 +---- options_test.go | 10 +++++----- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/config.json.example b/config.json.example index 724bf71..9d6dd6b 100644 --- a/config.json.example +++ b/config.json.example @@ -6,7 +6,7 @@ "unixSocketEnabled": false, "httpEnabled": true, "sdkKey": "dvc_YOUR_KEY_HERE", - "logFile": "/var/log/devcycle.log", + "logFile": "", "platformData": { "sdkType": "server", "sdkVersion": "2.10.2", diff --git a/options.go b/options.go index 8dcc92e..186eddd 100644 --- a/options.go +++ b/options.go @@ -34,7 +34,7 @@ type ProxyInstance struct { SSEEnabled bool `json:"sseEnabled" envconfig:"SSE_ENABLED" default:"false" desc:"Whether to enable the SSE server. Requires setting sseHostname param too. Defaults to false."` SSEHostname string `json:"sseHostname" envconfig:"SSE_HOSTNAME" desc:"The hostname to provide to clients to connect to for SSE requests. This must be reachable from the clients and can be either a DNS hostname or a raw IP address."` SDKKey string `json:"sdkKey" required:"true" envconfig:"SDK_KEY" desc:"The Server SDK key to use for this instance."` - LogFile string `json:"logFile" default:"/var/log/devcycle.log" envconfig:"LOG_FILE" desc:"The path to the log file. Defaults to /var/log/devcycle.log"` + LogFile string `json:"logFile" default:"" envconfig:"LOG_FILE" desc:"The path to the log file."` PlatformData devcycle.PlatformData `json:"platformData" required:"true"` SDKConfig SDKConfig `json:"sdkConfig" required:"true"` dvcClient *devcycle.Client @@ -130,9 +130,6 @@ func (i *ProxyInstance) Default() { if i.HTTPEnabled && i.HTTPPort == 0 { i.HTTPPort = 8080 } - if i.LogFile == "" { - i.LogFile = "/var/log/devcycle.log" - } if i.UnixSocketEnabled { if i.UnixSocketPath == "" { i.UnixSocketPath = "/tmp/devcycle.sock" diff --git a/options_test.go b/options_test.go index 8151501..cb9f3d3 100644 --- a/options_test.go +++ b/options_test.go @@ -41,7 +41,7 @@ func TestParseConfig(t *testing.T) { UnixSocketEnabled: false, HTTPEnabled: true, SDKKey: "dvc-test-key", - LogFile: "/var/log/devcycle.log", + LogFile: "", PlatformData: api.PlatformData{}, SDKConfig: SDKConfig{}, }, @@ -82,7 +82,7 @@ func TestParseConfig(t *testing.T) { UnixSocketPermissions: "0755", HTTPEnabled: false, SDKKey: "dvc-test-key", - LogFile: "/var/log/devcycle.log", + LogFile: "", PlatformData: api.PlatformData{ SdkType: "sdk type", SdkVersion: "v1.2.3", @@ -124,7 +124,7 @@ func TestParseConfig(t *testing.T) { UnixSocketEnabled: false, HTTPEnabled: false, SDKKey: "dvc-sample-key", - LogFile: "/var/log/devcycle.log", + LogFile: "", PlatformData: api.PlatformData{}, SDKConfig: defaultSDKConfig, }, @@ -144,7 +144,7 @@ func TestParseConfig(t *testing.T) { UnixSocketEnabled: false, HTTPEnabled: false, SDKKey: "dvc-sample-key", - LogFile: "/var/log/devcycle.log", + LogFile: "", PlatformData: api.PlatformData{}, SDKConfig: defaultSDKConfig, }, @@ -163,7 +163,7 @@ func TestParseConfig(t *testing.T) { UnixSocketEnabled: false, HTTPEnabled: true, SDKKey: "dvc_YOUR_KEY_HERE", - LogFile: "/var/log/devcycle.log", + LogFile: "", SSEEnabled: false, PlatformData: api.PlatformData{ SdkType: "server",