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
|
ENV=debug
|
||||||
PORT=3000
|
PORT=3000
|
||||||
SEED_DB=true
|
IS_DB_SEEDED=true
|
||||||
IS_RATE_LIMITER_ENABLED=true
|
IS_RATE_LIMITER_ENABLED=true
|
||||||
THREADS_MAX_COUNT=50
|
THREADS_MAX_COUNT=50
|
||||||
POSTGRES_URL=postgres://localhost/micrach?pool_max_conns=5
|
POSTGRES_URL=postgres://localhost/micrach?pool_max_conns=5
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
type AppConfig struct {
|
type AppConfig struct {
|
||||||
Env string
|
Env string
|
||||||
Port int
|
Port int
|
||||||
SeedDb bool
|
IsDbSeeded bool
|
||||||
IsRateLimiterEnabled bool
|
IsRateLimiterEnabled bool
|
||||||
ThreadsMaxCount int
|
ThreadsMaxCount int
|
||||||
ThreadBumpLimit int
|
ThreadBumpLimit int
|
||||||
@ -49,7 +49,7 @@ func getValueOrDefaultString(value string, defaultValue string) string {
|
|||||||
func getAppConfig() AppConfig {
|
func getAppConfig() AppConfig {
|
||||||
env := getValueOrDefaultString(os.Getenv("ENV"), "release")
|
env := getValueOrDefaultString(os.Getenv("ENV"), "release")
|
||||||
port := getValueOrDefaultInt(os.Getenv("PORT"), 3000)
|
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)
|
isRateLimiterEnabled := getValueOrDefaultBoolean(os.Getenv("IS_RATE_LIMITER_ENABLED"), true)
|
||||||
threadsMaxCount := getValueOrDefaultInt(os.Getenv("THREADS_MAX_COUNT"), 50)
|
threadsMaxCount := getValueOrDefaultInt(os.Getenv("THREADS_MAX_COUNT"), 50)
|
||||||
threadBumpLimit := getValueOrDefaultInt(os.Getenv("THREAD_BUMP_LIMIT"), 500)
|
threadBumpLimit := getValueOrDefaultInt(os.Getenv("THREAD_BUMP_LIMIT"), 500)
|
||||||
@ -58,7 +58,7 @@ func getAppConfig() AppConfig {
|
|||||||
return AppConfig{
|
return AppConfig{
|
||||||
Env: env,
|
Env: env,
|
||||||
Port: port,
|
Port: port,
|
||||||
SeedDb: seedDb,
|
IsDbSeeded: isDbSeeded,
|
||||||
IsRateLimiterEnabled: isRateLimiterEnabled,
|
IsRateLimiterEnabled: isRateLimiterEnabled,
|
||||||
ThreadsMaxCount: threadsMaxCount,
|
ThreadsMaxCount: threadsMaxCount,
|
||||||
ThreadBumpLimit: threadBumpLimit,
|
ThreadBumpLimit: threadBumpLimit,
|
||||||
|
@ -8,7 +8,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
ENV: release
|
ENV: release
|
||||||
PORT: ${PORT}
|
PORT: ${PORT}
|
||||||
SEED_DB: ${SEED_DB}
|
IS_DB_SEEDED: ${IS_DB_SEEDED}
|
||||||
IS_RATE_LIMITER_ENABLED: ${IS_RATE_LIMITER_ENABLED}
|
IS_RATE_LIMITER_ENABLED: ${IS_RATE_LIMITER_ENABLED}
|
||||||
THREADS_MAX_COUNT: ${THREADS_MAX_COUNT}
|
THREADS_MAX_COUNT: ${THREADS_MAX_COUNT}
|
||||||
POSTGRES_URL: ${POSTGRES_URL}
|
POSTGRES_URL: ${POSTGRES_URL}
|
||||||
|
Loading…
Reference in New Issue
Block a user