His proposal is another. It is to condense configs into a single flag per category of the flags itself.
Loading from the config file won’t be different.
e.g.
--vault = All about Vault
--collector = All about Jaeger
--cache = All about cache configs
This should come from Viber\Cobra lib. But I think it is already possible.
Not sure, dumping flags would make the user’s head boil. Several configs aren’t necessarily needed to use. The user would freeze thinking that he has to understand the whole thing to get up and running.
I just want to pass all my necessary parameters in one line.
neither --vault = All about Vault nor --vault-key1=v1 --vault-key2=v2 can make it short.
If it support load it from config file,
then I can just start it with dgraph alpha -c config.yml
In the config file,we can support all format we like.
vault {
key1: val1
key2: val2
}
or
vault.key1 = val1
vault.key2 = val2
or
vault:
key1:
val1
key2:
val2
If I have a config file named sample.yml like this
alpha:
# list of Dgraph zero addresses of the form IP_ADDRESS:PORT. (default "localhost:5080")
zero:
- localhost:5080
- zero1:5080
#port_offset int Value added to all listening port numbers. [Internal=7080, HTTP=8080, Grpc=9080]
# it is suggest to pass from command-line when you setup your alpha cluster
# dgraph alpha -c config.yml --alpha.port_offset=1
port:
# grpc:9080
# http: 8080
# internal: 7080
offset: 0
vault:
# string Vault server's address in the form http://ip:port. (default "http://localhost:8200")
addr: "http://localhost:8200"
# Vault kv store field whose value is the Base64 encoded encryption key. (default "enc_key")
field: "enc_key"
The comment for each field makes it more clear .
The struct like
alpha:
vault:
addr: v1
field: v2
is more obvious than --vault.addr=v1 or --vault= addr:v1; field:v2;
I don’t like have too many command-line flags in one command. you can’t edit it as simple as in your editor.
If it longer than one line, I often make a shell script to run it.
dgraph alpha command has almost 60 flags.
I don’t need to care it now for the number is not too big. However, if it keep growing, it matters.