Skip to content

feat!: take routing, app, cache and Redis settings from config, not the environment - #18

Merged
arjendevos merged 1 commit into
mainfrom
feat/config
Nov 23, 2026
Merged

arjendevos merged 1 commit into
mainfrom
feat/config

Conversation

@arjendevos

@arjendevos arjendevos commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Core read HOST, PORT, SHUTDOWN_TIMEOUT, APP_ENV, CACHE_DRIVER and REDIS_* itself. Each now comes from a config struct the app passes in:

app.New(config.App,
	app.WithRedis(config.Redis),
	app.WithCache(cache.WithConfig(config.Cache)),
	app.WithRouting(routing.WithConfig(config.Server{
		Port:            80,
		HealthEndpoint:  "/health",
		TrustedPlatform: gin.PlatformCloudflare,
		ShowErrors:      config.App.Environment != config.ProductionEnvironment,
	})),
)
  • Routing: config.Server holds host, port, shutdown timeout, health endpoint, trusted platform, and whether failed responses include their error. Required by Run; Engine() still works without it for tests.
  • App: app.New takes config.App and passes the environment to the scheduler.
  • Cache: config.Cache picks the driver and Redis connection. The queue and the rate limiter use the app's cache instead of building their own.
  • Redis: config.Redis holds named connections: single, sentinel or cluster.
  • config/env.helpers.go still reads APP_ENV to pick which .env file to load, since that runs before any config exists.

Breaking: app.New takes a config.App; routing.WithHealth and WithTrustedPlatform are gone; routing, the cache and Redis need their config; the variables above are no longer read.

Tested: tests/routing, tests/app, tests/scheduling, tests/cache and tests/redis cover each config, including what happens without one.

Replaces #12, #13, #14 and #15.

…he environment

Core read HOST, PORT, SHUTDOWN_TIMEOUT, APP_ENV, CACHE_DRIVER and REDIS_*
itself. Each now comes from a config struct the app passes in:

- routing.WithConfig(config.Server): host, port, shutdown timeout, health
  endpoint, trusted platform, and whether failed responses show their
  error. Required by Run. WithHealth and WithTrustedPlatform are gone.
- app.New(config.App, ...): the environment, handed to the scheduler.
- cache.WithConfig(config.Cache): the driver and Redis connection. The
  queue and the rate limiter use the app's cache instead of their own.
- app.WithRedis(config.Redis): named connections, single, sentinel or
  cluster.

BREAKING CHANGE: app.New takes a config.App; routing, the cache and Redis
need their config; the environment variables above are no longer read.
@arjendevos
arjendevos changed the base branch from feat/queue-groups to main November 23, 2026 18:06
@arjendevos
arjendevos merged commit f6df4af into main Nov 23, 2026
2 checks passed
@arjendevos
arjendevos deleted the feat/config branch November 23, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant