mirror of
https://github.com/yanislav-igonin/micrach
synced 2025-07-01 17:01:14 +03:00
add new var to config
This commit is contained in:
parent
d01924f057
commit
f577dbcc7f
@ -2,6 +2,7 @@ package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
@ -11,6 +12,7 @@ type AppConfig struct {
|
||||
Port int
|
||||
SeedDb bool
|
||||
IsRateLimiterEnabled bool
|
||||
ThreadsMaxCount int
|
||||
}
|
||||
|
||||
type DbConfig struct {
|
||||
@ -29,7 +31,7 @@ func getAppConfig() AppConfig {
|
||||
}
|
||||
port, err := strconv.Atoi(portString)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("Could not parse %s to int", portString))
|
||||
log.Panicln(fmt.Sprintf("Could not parse %s to int", portString))
|
||||
}
|
||||
|
||||
seedDbString := os.Getenv("SEED_DB")
|
||||
@ -38,11 +40,18 @@ func getAppConfig() AppConfig {
|
||||
isRateLimiterEnabledString := os.Getenv("IS_RATE_LIMITER_ENABLED")
|
||||
isRateLimiterEnabled := isRateLimiterEnabledString == "true"
|
||||
|
||||
threadsMaxCountString := os.Getenv("THREADS_MAX_COUNT")
|
||||
threadsMaxCount, err := strconv.Atoi(threadsMaxCountString)
|
||||
if err != nil {
|
||||
log.Panicln(fmt.Sprintf("Could not parse %s to int", threadsMaxCountString))
|
||||
}
|
||||
|
||||
return AppConfig{
|
||||
Env: env,
|
||||
Port: port,
|
||||
SeedDb: seedDb,
|
||||
IsRateLimiterEnabled: isRateLimiterEnabled,
|
||||
ThreadsMaxCount: threadsMaxCount,
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user