diff options
| author | Paul Buetow <paul@buetow.org> | 2025-07-02 22:28:05 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-07-02 22:28:05 +0300 |
| commit | a4eb3cc769c13312fdd4b7aaa20659e408f734b7 (patch) | |
| tree | e80d3da40af872f43e7698c13fd339286dfd2391 /internal/config | |
| parent | 17ee5e62c2b1037c21cb36f2677d2c538e2542cb (diff) | |
feat: make turbo mode configurable via config file
Add TurboModeEnable setting to server configuration with environment variable override.
The DTAIL_TURBOBOOST_ENABLE environment variable takes precedence over config file setting.
Turbo mode is automatically disabled for MapReduce operations to prevent data accuracy issues.
- Add TurboModeEnable boolean to ServerConfig struct
- Update config initializer to check environment variable for backward compatibility
- Replace direct env var checks with config.Server.TurboModeEnable throughout codebase
- Enable turbo mode in example config file (dtail.json.example)
- Add property to JSON schema with descriptive documentation
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'internal/config')
| -rw-r--r-- | internal/config/initializer.go | 5 | ||||
| -rw-r--r-- | internal/config/server.go | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/internal/config/initializer.go b/internal/config/initializer.go index 9c3bf64..e750a1a 100644 --- a/internal/config/initializer.go +++ b/internal/config/initializer.go @@ -92,6 +92,11 @@ func (in *initializer) processEnvVars(args *Args) { if len(sshPrivateKeyPathFile) > 0 && args.SSHPrivateKeyFilePath == "" { args.SSHPrivateKeyFilePath = sshPrivateKeyPathFile } + // Check if turbo mode should be enabled from environment variable + // This allows backward compatibility with existing scripts + if Env("DTAIL_TURBOBOOST_ENABLE") { + in.Server.TurboModeEnable = true + } } func (in *initializer) setupConfig(sourceCb transformCb, args *Args, diff --git a/internal/config/server.go b/internal/config/server.go index cb9ca2b..d108ea3 100644 --- a/internal/config/server.go +++ b/internal/config/server.go @@ -67,6 +67,11 @@ type ServerConfig struct { Ciphers []string `json:",omitempty"` // The allowed MAC algorithms. MACs []string `json:",omitempty"` + // Enable turbo mode for optimized file processing. When enabled, cat/grep/tail operations + // use a direct writing approach that bypasses internal channels for better performance. + // Note: This is disabled by default for MapReduce operations due to known issues with + // high-concurrency aggregate processing. + TurboModeEnable bool `json:",omitempty"` } // Create a new default server configuration. @@ -85,6 +90,7 @@ func newDefaultServerConfig() *ServerConfig { Permissions: Permissions{ Default: defaultPermissions, }, + TurboModeEnable: false, // Default to false for safety, can be enabled via config } } |
