diff --git a/.env.example b/.env.example index 62f348e..86c77e9 100644 --- a/.env.example +++ b/.env.example @@ -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 diff --git a/config/config.go b/config/config.go index 1124423..67dac10 100644 --- a/config/config.go +++ b/config/config.go @@ -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, diff --git a/docker-compose.yml b/docker-compose.yml index 64174ba..256cc7b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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} diff --git a/main.go b/main.go index fe46587..c2ee44f 100644 --- a/main.go +++ b/main.go @@ -26,7 +26,7 @@ func main() { Db.Migrate() defer Db.Pool.Close() gin.SetMode(Config.App.Env) - if Config.App.SeedDb { + if Config.App.IsDbSeeded { Repositories.Seed() }