3 ms·
You can't be serious; I can't stand having to guess what kind of crazy markup is required to express things in toml. As a concrete example I converted my local
by mdaniel 4y ago
You can't be serious; I can't stand having to guess what kind of crazy markup is required to express things in toml. As a concrete example I converted my local kubeconfig (which is yaml) and here are the completely random characters indicating some kind of hierarchy
apiVersion = "v1"
current-context = ""
kind = "Config"
[[clusters]]
name = "my-cluster"
[clusters.cluster]
certificate-authority-data = "LS0tL..."
server = "https://example.com"
[[contexts]]
name = "context0"
[contexts.context]
cluster = "my-cluster"
user = "my-user"
[[contexts]]
name = "context1"
[contexts.context]
cluster = "my-cluster"
user = "my-user"
[[users]]
name = "my-user"
[users.user]
[users.user.exec]
apiVersion = "client.authentication.k8s.io/v1beta1"
args = ["eks", "get-token"]
command = "aws"
- jsmith45 4y agoIt is really just arrays of objects/dicts that get complicated with TOML. For dictionary properties not inside an array, you can either fully specify the path `foor.bar.baz = 7`, or use a header like `[foo.bar]` and specify `baz=7`. Also if I was handwriting that I would probably make more use of doted property names implying dictionaries like so, which though it has a little bit more repetition in property names, seems easier to read: apiVersion = "v1" current-context = "" kind = "Config" [[clusters]] name = "my-cluster" cluster.certificate-authority-data = "LS0tL..." cluster.server = "https://example.com" [[contexts]] name = "context0" context.cluster = "my-cluster" context.user = "my-user" [[contexts]] name = "context1" context.cluster = "my-cluster" context.user = "my-user" [[users]] name = "my-user" user.exec.apiVersion = "client.authentication.k8s.io/v1beta1" user.exec.args = ["eks", "get-token"] user.exec.command = "aws" If k8s was designed with TOML in mind, it probably have been structured differently, such that "Contexts" for example might be just a dictionary mapping names to an object that has the values from the "context" property (The existing pattern of an array of objects where each object has a name, but store most of their properties in a property whose name matches the object's type is already weird, but doesn't look terrible in yaml.) Such a redesigned to be a more TOML friendly schema would then look like this: apiVersion = "v1" current-context = "" kind = "Config" [clusters.my-cluster] certificate-authority-data = "LS0tL..." server = "https://example.com" [contexts.context0] cluster = "my-cluster" user = "my-user" [contexts.context1] cluster = "my-cluster" user = "my-user" [users.my-user.exec] apiVersion = "client.authentication.k8s.io/v1beta1" args = ["eks", "get-token"] command = "aws"
- rewgs 4y agoAs the other person who replied to you noted, a converted-from-yaml file wherein the service is designed to use yaml, not toml, it hardly a good example of toml. Of course your example is bad. At least use a native toml file as an example.