-
-
Notifications
You must be signed in to change notification settings - Fork 164
Survey of Config Languages
andychu edited this page Jun 25, 2022
·
58 revisions
Config languages let you provide parameters to software, usually at runtime. For example:
- What flags should we pass to an executable?
-
--port 80
to a web server, or--port 8080
? -
-O0
to a compiler for debug builds, or-O2
for release builds?
-
- What environment variables?
PATH
,PYTHONPATH
, etc. - What kind of container or VM should a program run in?
- How should a program be scheduled? (both locally and remotely)
This page is organized by least expressive (languages for string data) to most expressive (using general-purpose languages for configuration). This doesn't imply anything about what solution you should use!
Oil is on the right of that spectrum: Hay Ain't YAML - Custom Languages for Unix Systems. It's the only config language embedded in a shell! It uses a staged evaluation model.
This page is editable, so feel free to add links below. And feel free to add notable usages, especially under Who Uses it?
- The informal INI file format expresses key-value pairs in sections.
- It's used by git for
.git/config
, and I believe Mercurial.
- It's used by git for
-
XML started as a document language
- But it's often used in IDE "project files", like Eclipse and Visual Studio.
- It has a model of tags and attributes, but no arrays, integers, booleans, etc.
-
YAML is (surprisingly) the de facto control plane language of the cloud!
- Although it has JSON-like types, it's arguably string-ish because it has type confusion, e.g. the boolean
no
vs the string"no"
. - Almost all continuous integration / build services use it: sourcehut, Gitlab CI, Github Actions, Circle CI, Travis CI, etc.
- Google App Engine uses it for
app.yaml
- Kubernetes uses it, often with Go Templates (e.g. Helm)
- Although it has JSON-like types, it's arguably string-ish because it has type confusion, e.g. the boolean
These languages allow you to express structured and dynamically typed data, but they aren't programmable.
-
JSON is derived from JavaScript, but it's now available in almost every language. It's used by node.js in
package.json
.- JavaScript Object Notation is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate.
-
TOML looks like an .INI file, but it has JSON-like types. It's used by Rust in
Cargo.toml
.- A config file format for humans. TOML aims to be a minimal configuration file format that's easy to read due to obvious semantics.
-
sdlang -- appears to be used by Oracle, Bank of America, etc.?
- SDLang is a simple and concise way to textually represent data. It has an XML-like structure – tags, values and attributes – which makes it a versatile choice for data serialization, configuration files, or declarative languages. Its syntax was inspired by the C family of languages
-
Go templates are for arbitrary text and HTML.
- They are often used to generate variants of a YAML file.
- M4 is used by autotools to generate shell and Make.
- CMake generates Make and Ninja files.
-
UCL (Universal Configuration Language)
- UCL is heavily infused by nginx configuration as the example of a convenient configuration system. However, UCL is fully compatible with JSON format and is able to parse json files.
- Who uses it?
-
HCL (Hashicorp Configuration Language) is used by Terraform for AWS. Similar to UCL.
- HCL is a toolkit for creating structured configuration languages that are both human- and machine-friendly, for use with command-line tools. Although intended to be generally useful, it is primarily targeted towards devops tools, servers, etc.
-
UCG (Universal Grammar for Configuration) is designed to solve the "templating" problem for JSON, YAML, etc.
- Templates can be difficult to manage without introducing hard to see errors in the serialization format they are generating. Most templating engines aren't aware of the format they are templating
- Who uses it?
- Nix Expressions Language is used to write Nix package definitions.
-
Jsonnet - The Data Templating Language.
- Generate config data; Side-effect free; Organize, simplify, unify; Manage sprawling config
-
Starlark
- Starlark is a [dialect of Python] intended for use as a configuration language. It was designed for the Bazel build system
-
Cue
- Validate, define, and use dynamic and text-based data
- The Logic of CUE -- Types are Values; The Value Lattic
- CUE History -- Although it is a very different language, the roots of CUE lie in GCL, the dominant configuration language in use at Google. It was originally designed to configure Borg, the predecessor of Kubernetes.
- Who uses it?
-
Dhall
- Dhall is a programmable configuration language that you can think of as: JSON + functions + types + imports
- Note: Dhall isn't turing complete, but this restriction has no useful engineering properties.
- Unconstrained side effects are the thing that matter for configuration, not computation.
- Analogy: a language being context-free has no useful engineering properties. But being regular has a very useful engineering property: it can be recognized in constant space and linear time (with a NFA/DFA).
- Who uses it?
Proprietary / non-open-source: Google's BCL
- Hay Ain't YAML - Custom Languages for Unix Systems. The only config language that's embedded in a shell! It uses a staged evaluation model.
- G-Expressions in Guile Scheme are used by the Guix distro
- Ruby blocks in Vagrant, Rake, etc.
-
Tcl commands can also be used to define data.
- Data Definition and Code Generation in Tcl (2003, PDF)
- Related surveys
- Notes on Oil: Config Dialect / Hay
- lobste.rs thread on Hay, with more comparisons