Search⌘ K

Choosing Configs

Explore techniques for managing multiple configuration layers in TypeScript applications using fp-ts constructs like Alt, Alternative, and Monoids. Understand how to combine fallback settings elegantly without complex conditionals to enhance your reservation app. This lesson helps you implement clear config precedence for basic, system, and user settings.

Alt and Alternative

We dealt with a tiny configuration in our Create Lambda. Often, though, applications have not only much bigger configs, but also various defaults to fall back to. We might have default program settings that are overwritten by system settings, and overwritten by specific user settings. Are there elegant ways to handle such a situation, preferably without too much conditional branching? For easy scenarios, we might consider using Alt and Alternative. Alt is similar to semigroup, except that it can work with monads. ...