(ctx, key, value)
Assigns values to config file entries. If the value is omitted,
    you will be prompted, with the input hidden if it is sensitive.

    \b
    `$ ddev config set github.user foo`

        New setting:
        [github]
        user = "foo"

    You can also assign values on a per-org basis.

    \b
    `$ ddev config set orgs.<ORG_NAME>.api_key`

        New setting:
        [orgs.<ORG_NAME>]
        api_key = "***********"
Assigns values to config file entries. If the value is omitted,
    you will be prompted, with the input hidden if it is sensitive.
Assigns values to config file entries . If the value is omitted you will be prompted with the input hidden if it is sensitive .
def set_value(ctx, key, value):
    """Assigns values to config file entries. If the value is omitted,
    you will be prompted, with the input hidden if it is sensitive.

    \b
    `$ ddev config set github.user foo`

        New setting:
        [github]
        user = "foo"

    You can also assign values on a per-org basis.

    \b
    `$ ddev config set orgs.<ORG_NAME>.api_key`

        New setting:
        [orgs.<ORG_NAME>]
        api_key = "***********"
    """
    scrubbing = False
    if value is None:
        scrubbing = any(fnmatch(key, pattern) for pattern in SECRET_KEYS)
        value = click.prompt(f'Value for `{key}`', hide_input=scrubbing)

    if key in ('repos.core', 'repos.extras', 'repos.agent', 'repos.marketplace') and not value.startswith('~'):
        value = os.path.abspath(value)

    user_config = new_config = ctx.obj
    user_config.pop('repo_choice', None)

    data = [value]
    data.extend(reversed(key.split('.')))
    key = data.pop()
    value = data.pop()

    # Use a separate mapping to show only what has changed in the end
    branch_config_root = branch_config = {}

    # Consider dots as keys
    while data:
        default_branch = {value: ''}
        branch_config[key] = default_branch
        branch_config = branch_config[key]

        new_value = new_config.get(key)
        if not hasattr(new_value, 'get'):
            new_value = default_branch

        new_config[key] = new_value
        new_config = new_config[key]

        key = value
        value = data.pop()

    value = string_to_toml_type(value)
    branch_config[key] = new_config[key] = value

    save_config(user_config)

    output_config = scrub_secrets(branch_config_root) if scrubbing else branch_config_root
    echo_success('New setting:')
    echo_info(toml.dumps(output_config).rstrip())
def set_value ( ctx , key , value ) : scrubbing = False if value is None : scrubbing = any ( fnmatch ( key , pattern ) for pattern in SECRET_KEYS ) value = click . prompt ( f'Value for `{key}`' , hide_input = scrubbing ) if key in ( 'repos.core' , 'repos.extras' , 'repos.agent' , 'repos.marketplace' ) and not value . startswith ( '~' ) : value = os . path . abspath ( value ) user_config = new_config = ctx . obj user_config . pop ( 'repo_choice' , None ) data = [ value ] data . extend ( reversed ( key . split ( '.' ) ) ) key = data . pop ( ) value = data . pop ( ) # Use a separate mapping to show only what has changed in the end branch_config_root = branch_config = { } # Consider dots as keys while data : default_branch = { value : '' } branch_config [ key ] = default_branch branch_config = branch_config [ key ] new_value = new_config . get ( key ) if not hasattr ( new_value , 'get' ) : new_value = default_branch new_config [ key ] = new_value new_config = new_config [ key ] key = value value = data . pop ( ) value = string_to_toml_type ( value ) branch_config [ key ] = new_config [ key ] = value save_config ( user_config ) output_config = scrub_secrets ( branch_config_root ) if scrubbing else branch_config_root echo_success ( 'New setting:' ) echo_info ( toml . dumps ( output_config ) . rstrip ( ) )