def set_environment(environment, system=False):
    """
    Set engine environment values in the config file.

    :param environment: A dictionary containing the environment variable
                        settings as key/value pairs.
    :keyword system: Set to True to modify the system configuration file.
                     If not set, the user config file will be modified.
    """
    config_filename = \
        _SYSTEM_CONFIG_FILE if system is True else _USER_CONFIG_FILE
    config = _read_config(config_filename)

    section = _ENVIRONMENT_SECTION_NAME
    for key in environment.keys():
        config.set(section, key, environment[key])
    _write_config(config, config_filename)