5 ms·
CUE has been an absolute joy to work with on configuration problems. It’s a typed language which is something that’s been a massive gap in the config language s
by disintegrator 4y ago
CUE has been an absolute joy to work with on configuration problems. It’s a typed language which is something that’s been a massive gap in the config language space when looking at yaml, toml, json, etc...
https://cuelang.org/ https://cuelang.org/
- betwixthewires 4y agoWhy would you need typing in a configuration file? I would think a configuration file would be specific to your program and any interpretation of data would be handled by your program.
- planckscnst 4y agoCUE's type system is also its validation system. It's extremely flexible. You can define custom types and your own constraints on those types. It allows for disjunctive constraints (e.g. this value must be an integer > 0 or the string value "none"). The types compose well together. I'd highly recommend reading through the docs - they're great.
- arccy 4y agoif your config is longer and semi repetitive, you can use it to template things out while still having a strong schema at every step
- disintegrator 4y agoMy initial comment was very vague and I'm glad to see others have replied to fill in the gaps. If your service/system has a sufficiently large configuration space, like say, Kubernetes, then a typed configuration language can greatly improve the development experience by spotting errors early on. You get a very fast feedback loop that you set the wrong value for some config option before attempting to deploy the change. Different services will give you appropriate feedback about wrong config options but that is sometimes a few steps removed from your development environment e.g. You might find out after you push a PR and CI/CD fails or after you merge the PR even. The type system also has great second order benefits like allowing us to build an language server protocol implementation for CUE that has rich diagnostics, auto-complete, jump to definition, rename symbol features. Something that cannot be done _as well_ effectively in untyped languages. I'm still scratching the surface. CUE does more than add types to config and I would encourage you to dig into it if you have spare time. By virtue of providing a great type system, it also manages to reduce boilerplate as yet another second order benefit. Boilerplate reduction is something where tools like Jsonnet attack as a primary goal but over enough time you're back at having seas of untyped config and indirection that are hard to navigate or contribute to and you're back at square one.
- verdverm 4y agoOne of the benefits is that the checking is handled by CUE, so every program does not have to do validation checks like regexp matching, int bounds, required keys, default values, transforms... Also, imports and dependency management for config will be big
- cwp 4y agoI'll echo this: CUE provides a lot of expressive power without being a Turing-complete language. That's a sweet spot for configuration—you can DRY things up and catch errors early, without introducing nondeterministic behavior.