Work on header parsing & saving other files
This commit is contained in:
17
config.go
17
config.go
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user