Skip to content

Commit

Permalink
chore: Set default log file to empty string (#28)
Browse files Browse the repository at this point in the history
* Set default log file to empty string

* update tests

* update tests

* remove from example config
  • Loading branch information
JamieSinn authored Oct 7, 2024
1 parent 59cfe86 commit 99df470
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 1 addition & 4 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
10 changes: 5 additions & 5 deletions options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
},
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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,
},
Expand All @@ -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,
},
Expand All @@ -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",
Expand Down

0 comments on commit 99df470

Please sign in to comment.