mirror of
https://github.com/yanislav-igonin/micrach
synced 2024-12-22 14:22:33 +03:00
feat: rename env var
This commit is contained in:
parent
aafbf6b1fe
commit
164f41ed9e
@ -1,6 +1,6 @@
|
||||
ENV=debug
|
||||
PORT=3000
|
||||
SEED_DB=true
|
||||
IS_DB_SEEDED=true
|
||||
IS_RATE_LIMITER_ENABLED=true
|
||||
THREADS_MAX_COUNT=50
|
||||
POSTGRES_URL=postgres://localhost/micrach?pool_max_conns=5
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
type AppConfig struct {
|
||||
Env string
|
||||
Port int
|
||||
SeedDb bool
|
||||
IsDbSeeded bool
|
||||
IsRateLimiterEnabled bool
|
||||
ThreadsMaxCount int
|
||||
ThreadBumpLimit int
|
||||
@ -49,7 +49,7 @@ func getValueOrDefaultString(value string, defaultValue string) string {
|
||||
func getAppConfig() AppConfig {
|
||||
env := getValueOrDefaultString(os.Getenv("ENV"), "release")
|
||||
port := getValueOrDefaultInt(os.Getenv("PORT"), 3000)
|
||||
seedDb := getValueOrDefaultBoolean(os.Getenv("SEED_DB"), false)
|
||||
isDbSeeded := getValueOrDefaultBoolean(os.Getenv("IS_DB_SEEDED"), false)
|
||||
isRateLimiterEnabled := getValueOrDefaultBoolean(os.Getenv("IS_RATE_LIMITER_ENABLED"), true)
|
||||
threadsMaxCount := getValueOrDefaultInt(os.Getenv("THREADS_MAX_COUNT"), 50)
|
||||
threadBumpLimit := getValueOrDefaultInt(os.Getenv("THREAD_BUMP_LIMIT"), 500)
|
||||
@ -58,7 +58,7 @@ func getAppConfig() AppConfig {
|
||||
return AppConfig{
|
||||
Env: env,
|
||||
Port: port,
|
||||
SeedDb: seedDb,
|
||||
IsDbSeeded: isDbSeeded,
|
||||
IsRateLimiterEnabled: isRateLimiterEnabled,
|
||||
ThreadsMaxCount: threadsMaxCount,
|
||||
ThreadBumpLimit: threadBumpLimit,
|
||||
|
@ -8,7 +8,7 @@ services:
|
||||
environment:
|
||||
ENV: release
|
||||
PORT: ${PORT}
|
||||
SEED_DB: ${SEED_DB}
|
||||
IS_DB_SEEDED: ${IS_DB_SEEDED}
|
||||
IS_RATE_LIMITER_ENABLED: ${IS_RATE_LIMITER_ENABLED}
|
||||
THREADS_MAX_COUNT: ${THREADS_MAX_COUNT}
|
||||
POSTGRES_URL: ${POSTGRES_URL}
|
||||
|
Loading…
Reference in New Issue
Block a user