forked from siglens/siglens
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to not compress static files (siglens#1670)
* Add option to not compress static files * Default config value to true * Make compression enable Brotli compression
- Loading branch information
1 parent
d6c2f9a
commit bf75587
Showing
4 changed files
with
48 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -200,6 +200,10 @@ func GetTLSPrivateKeyPath() string { | |
return runningConfig.TLS.PrivateKeyPath | ||
} | ||
|
||
func ShouldCompressStaticFiles() bool { | ||
return runningConfig.CompressStaticConverted | ||
} | ||
|
||
// used by | ||
func GetQueryHostname() string { | ||
return runningConfig.QueryHostname | ||
|
@@ -518,6 +522,8 @@ func GetTestConfig(dataPath string) common.Configuration { | |
QueryHostname: "", | ||
Log: common.LogConfig{LogPrefix: "", LogFileRotationSizeMB: 100, CompressLogFile: false}, | ||
TLS: common.TLSConfig{Enabled: false, CertificatePath: "", PrivateKeyPath: ""}, | ||
CompressStatic: "false", | ||
CompressStaticConverted: false, | ||
Tracing: common.TracingConfig{ServiceName: "", Endpoint: "", SamplingPercentage: 1}, | ||
DatabaseConfig: common.DatabaseConfig{Enabled: true, Provider: "sqlite"}, | ||
EmailConfig: common.EmailConfig{SmtpHost: "smtp.gmail.com", SmtpPort: 587, SenderEmail: "[email protected]", GmailAppPassword: " "}, | ||
|
@@ -792,6 +798,18 @@ func ExtractConfigData(yamlData []byte) (common.Configuration, error) { | |
config.TLS.PrivateKeyPath = strings.Trim(config.TLS.PrivateKeyPath, "./") | ||
} | ||
|
||
if len(config.CompressStatic) <= 0 { | ||
config.CompressStatic = "true" | ||
} | ||
compressStatic, err := strconv.ParseBool(config.CompressStatic) | ||
if err != nil { | ||
compressStatic = true | ||
config.CompressStatic = "true" | ||
log.Errorf("ExtractConfigData: failed to parse compress static flag. Defaulting to %v. Error: %v", | ||
compressStatic, err) | ||
} | ||
config.CompressStaticConverted = compressStatic | ||
|
||
// Check for Tracing Config through environment variables | ||
if os.Getenv("TRACESTORE_ENDPOINT") != "" { | ||
config.Tracing.Endpoint = os.Getenv("TRACESTORE_ENDPOINT") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters