threefoldtech / js-ng

next gen js
Apache License 2.0
5 stars 5 forks source link

jsctl config: handle nested keys #390

Closed abom closed 4 years ago

abom commented 4 years ago

We need to handle nested keys with jcstl config, maybe dot-separated

For example, we cannot set the value of the hostname of the redis store directly:

[stores]

[stores.redis]
hostname = "localhost"
port = 6379

It would be better to do it like e.g. poetry config:

jsctl config get stores.redis.hostname
jsctl config update stores.redis.hostname 172.17.0.2

What needed to be done:

@config.command()
@click.option("--name")
def get(name):
    value = get_config()[name]
    click.echo(format_config_parameter(name, value))

@config.command()
@click.option("--name")
@click.option("--value")
def set....
abom commented 4 years ago

still needs verification

alichaddad commented 4 years ago

Verifying