coreos / torus

Torus Distributed Storage
https://coreos.com/blog/torus-distributed-storage-by-coreos.html
Apache License 2.0
1.78k stars 172 forks source link

Support cli config .torus/config.json #314

Closed nak3 closed 8 years ago

nak3 commented 8 years ago

fixes https://github.com/coreos/torus/issues/176

nak3 commented 8 years ago

Usage example

write config file and view

$ ./bin/torusctl config

$ ./bin/torusctl config --view
{
    "etcd_config": {
        "default": {
            "etcd": "127.0.0.1:2379"
        }
    }
}

write config file with "production" profile and specify the profile

$ ./bin/torusctl config --profile=production --etcd=https://192.168.133.2:2379 --etcd-ca-file=/path --etcd-cert-file=/path --etcd-key-file=/path

$ ./bin/torusctl config --view
{
    "etcd_config": {
        "default": {
            "etcd": "127.0.0.1:2379"
        },
        "production": {
            "etcd": "https://192.168.133.2:2379",
            "etcd-ca-file": "/path",
            "etcd-cert-file": "/path",
            "etcd-key-file": "/path"
        }
    }
}

$ ./bin/torusctl init --profile=production

command line flags win the config file

$ ./bin/torusctl init --etcd=192.168.133.3
bzub commented 8 years ago

This is great. Can the config file be YAML instead of JSON? Fewer user errors with YAML I think.

nak3 commented 8 years ago

Thank you. I also prefer yaml to json. However, coreos's projects use json for their configuration like rkt and flannel. That's the reason why I chose json. It's up to coreos team.

barakmich commented 8 years ago

Yeah, JSON for the config files -- that's why you have a torusctl config command. Less user error in doing it that way.