4 ms·
I would be more interested in a stripped down JavaScript runtime for configuration. Some tooling already supports this paradigm. Embed something like QuickJS or
by tristan957 4y ago
I would be more interested in a stripped down JavaScript runtime for configuration. Some tooling already supports this paradigm. Embed something like QuickJS or a Lua interpreter and have the script export a config object. It feels too much like we want these plaintext config files to turn into fully-fledged scripts.
- andrewstuart2 4y agoIt's not stripped down, but Pulumi is a version of this. Regular code, and all the benefits and drawbacks of that approach, in your language(s) of choice to create infrastructure.
- tristan957 4y agoI haven't used Pulumi, but I have used Terraform (years ago). That is pretty much exactly what I am talking about, but instead of creating a new language, just use an already established language meant for scripting.
- mieubrisse 4y agoWe're trying to do something very similar to what the OP proposes at our current company (Kurtosis), and we explored YAML, Jsonnet, Dhall, CUE, and general-purpose languages and eventually settled on Starlark: https://docs.kurtosis.com/explanations/starlark#why-did-kurtosis-choose-starlark-for-its-environment-definitions https://docs.kurtosis.com/explanations/starlark#why-did-kurt... BLUF: Infrastructure seems to live in this weird "configuration code" space between pure config (YAML) and actual code. You want reusable config, but you don't want to have to understand the complexities of a real codebase. Jsonnet, Dhall, and CUE all have the simplicity you want, but we found the DSL we'd need to write to be rough. Starlark hits this very nice balance of safety and ease-of-readability (and as a bonus is basically just Python). We've been very happy with it so far.
- elcritch 4y agoI've started using this setup for my Nim projects. I created a project that lets me use Nim instead of YAML for a statically checked configuration system. It can be run and output json, yaml, or run as is in Nim code. Its been much nicer than pure YAML! https://github.com/elcritch/ants/tree/main https://github.com/elcritch/ants/tree/main Not satisfied I used a simple source filter to get a YAML compatible variant (WIP): https://github.com/elcritch/ants/blob/main/tests/cimport_example.yaml https://github.com/elcritch/ants/blob/main/tests/cimport_exa... Our concept of configs languages needs to keep evolving.
- brodouevencode 4y agoLike a CDK (cloud development kit)? Those tools already exist - like AWS CDK, Pulumi, CDK-TF - but they are hardly stripped down. AWS CDK for instance transpiles everything down to Typescript and those layers of abstractions make debugging painful.
- tristan957 4y agoYes kind of, but instead of creating a new language (like HCL), just use a language people already know, but strip the runtime to a minimal set of features.
- TechBro8615 4y agoWith Lua, you don't even need to export a config object, the Lua script is the config object. I do think there is some promise to this - see Neovim for example. There are a lot of downsides though, because now you've got a leaky config language instead of a leaky config interpreter.
- baq 4y agoLua has been created as a config language. I love to see the world coming full circle.
- tristan957 4y agoBorn in 1996, so I have no clue on the history of Lua, but good to know I am following in the footsteps of gods! :)