Work on header parsing & saving other files

This commit is contained in:
2024-10-08 18:16:47 +03:00
parent 7e849feffe
commit 91f8e69fdf
7 changed files with 138 additions and 80 deletions

View File

@@ -9,9 +9,10 @@ import (
)
type Config struct {
logLevel zerolog.Level
rootPath string
numOfWorkers int
logLevel zerolog.Level
rootPath string
numOfWorkers int
maxResponseSize int
}
func getConfig() *Config {
@@ -20,6 +21,7 @@ func getConfig() *Config {
"LOG_LEVEL",
"ROOT_PATH",
"NUM_OF_WORKERS",
"MAX_RESPONSE_SIZE",
} {
if env, ok := os.LookupEnv(envVar); !ok {
fmt.Fprintf(os.Stderr, "Missing env var %s\n", envVar)
@@ -48,6 +50,15 @@ func getConfig() *Config {
config.numOfWorkers = numOfWorkers
}
}
case "MAX_RESPONSE_SIZE":
{
if maxResponseSize, err := strconv.Atoi(env); err != nil {
fmt.Fprintf(os.Stderr, "Invalid MAX_RESPONSE_SIZE value\n")
os.Exit(1)
} else {
config.maxResponseSize = maxResponseSize
}
}
}
}
}