Save environment settings into environment directory, overwriting
        any existing configuration and discarding site config
771917
def save(self):
        
        task.save_new_environment(self.name, self.datadir, self.target,
            self.ckan_version, self.deploy_target, self.always_prod)
856355
public function saveEnvironment($environment) {
        $environment = (object) $environment;

        $environment_config = (array) $environment;
        unset($environment_config['app']);
        $this->config['apps'][$environment->app]['environments'][$environment->name] = $environment_config;
    }
360474
def save(self):
        """"""
        for server, conf in self.servers.iteritems():
            self._add_index_server()
            for conf_k, conf_v in conf.iteritems():
                if not self.conf.has_section(server):
                    self.conf.add_section(server)
                self.conf.set(server, conf_k, conf_v)

        with open(self.rc_file, 'wb') as configfile:
            self.conf.write(configfile)
        self.conf.read(self.rc_file)
3454
def create_env(self):
        
        root = path.Path(os.environ.get('SERVICES_ROOT', 'services'))
        self.env_path = (root / self.name).abspath()
        cmd = [
            self.python,
            '-c', 'import site; print(site.getusersitepackages())',
        ]
        out = subprocess.check_output(cmd, env=self._run_env)
        site_packages = out.decode().strip()
        path.Path(site_packages).makedirs_p()
19689
def config(env=DEFAULT_ENV, default=None, **overrides):
    """"""

    config = {}

    s = os.environ.get(env, default)

    if s:
        config = parse(s)

    overrides = dict([(k.upper(), v) for k, v in overrides.items()])

    config.update(overrides)

    return config
544612
def save_config(
        self, cmd="configuration write", confirm=False, confirm_response=""
    ):
        """"""
        output = self.enable()
        output += self.config_mode()
        output += self.send_command(cmd)
        output += self.exit_config_mode()
        return output
868226
protected function configureEnvironment ()
    {
        $this->configureApp ();
        $this->configureDriverSettings ();
        $this->configureDatabase ();
        $this->configureMailSettings ();

        if (!$this->_createEnvFile ()) {
            $this->info ('');
            $this->error ('File not created');
            exit;
        }

        $this->info ('');
    }
74449
def setup_config(command, filename, section, vars):
    """"""
    conf = appconfig('config:' + filename)
    load_environment(conf.global_conf, conf.local_conf)
1359575
def clear(self):
        """"""
        self._config = configparser.RawConfigParser()
        # Override config from command line even if we modify the config file and live reload it.
        self._override_config = {}

        self.read_config()
399037
def process_environment_settings(default_dictionary: dict, settings: typing.Optional[dict]=None,
                                 presets: typing.Optional[dict]=None):
    
    settings = settings if settings is not None else {}
    presets = presets if presets is not None else {}

    env_keys = sorted(set(default_dictionary.keys()) | set(presets.keys()))

    result_dict = {}

    for key in env_keys:
        if key in default_dictionary:
            new_dict = default_dictionary[key].copy()
        else:
            new_dict = {}

        new_dict.update(settings)

        if key in presets:
            new_dict.update(presets[key])

        result_dict[key] = new_dict

    return result_dict
1317128
def save_config(name, data, base='conf'):
    """"""
    if not os.path.exists(base):
        os.mkdir(base)
    fname = pjoin(base, name+'.json')
    with open(fname, 'w') as f:
        json.dump(data, f, indent=2)
1083737
function initConfig(sitePathOrConfig) {
  [
    // Check exact path
    sitePathOrConfig + '.js',
    path.join(sitePathOrConfig, 'config.js'),
    sitePathOrConfig,

    // Check under the working directory
    path.join(process.cwd(), sitePathOrConfig + '.js'),
    path.join(process.cwd(), sitePathOrConfig, 'config.js'),
    path.join(process.cwd(), sitePathOrConfig),

    // Check under the directory where gulp was started
    path.join(process.env.INIT_CWD, sitePathOrConfig + '.js'),
    path.join(process.env.INIT_CWD, sitePathOrConfig, 'config.js'),
    path.join(process.env.INIT_CWD, sitePathOrConfig),
  ]
  .some(function(configFile) {
    var stat;
    try {
      stat = fs.lstatSync(configFile);
    } catch(err) {}
    if ( stat && stat.isFile() ) {
      gutil.log('Using configuration in ', configFile);
      siteConfig = require(path.resolve(configFile));
      siteConfig.configFile = configFile;
      siteConfig.rootPath = path.dirname(siteConfig.configFile);
      return true;
    }
  });
  if ( !siteConfig || !siteConfig.paths ) {
    gutil.log('Invalid site configuration in ', sitePathOrConfig);
    process.exit(1);
  }
}
460975
def save_configure(self,
                       repo=None,
                       name=None,
                       groups=None,
                       config_val='',
                       from_registry=False,
                       main_cfg=False,
                       instances=1):
        
        def template_to_manifest(vent_template, manifest, tool, instances):
            """
            Helper function to transfer information from vent.template
            to plugin_manifest
            """
            sections = vent_template.sections()
            if sections[0]:
                for section in sections[1]:
                    section_dict = {}
                    if section == 'settings':
                        section_dict.update({'instances': str(instances)})
                    options = vent_template.options(section)
                    if options[0]:
                        for option in options[1]:
                            option_name = option
                            if option == 'name':
                                option_name = 'link_name'
                            opt_val = vent_template.option(section,
                                                           option)[1]
                            section_dict[option_name] = opt_val
                    if section_dict:
                        manifest.set_option(tool, section,
                                            json.dumps(section_dict))
                    elif manifest.option(tool, section)[0]:
                        manifest.del_option(tool, section)

        constraints = locals()
        del constraints['config_val']
        del constraints['from_registry']
        del constraints['main_cfg']
        del constraints['instances']
        del constraints['template_to_manifest']
        status = (True, None)
        fd = None
        # ensure instances is an int and remove instances from config_val to
        # ensure correct info
        instances = int(instances)
        config_val = re.sub(r'instances\ *=\ *\d+\n', '', config_val)
        api_system = System()
        manifest = api_system.manifest
        if not main_cfg:
            if not from_registry:
                # creating new instances
                if instances > 1:
                    fd, template_path = tempfile.mkstemp(suffix='.template')
                    # scrub name for clean section name
                    if re.search(r'\d+$', name):
                        name = re.sub(r'\d+$', '', name)
                    t_identifier = {'name': name,
                                    'branch': branch,
                                    'version': version}
                    result = Template(manifest).constrain_opts(
                        t_identifier, [])
                    tools = result[0]
                    tool = list(tools.keys())[0]
                else:
                    options = ['path', 'multi_tool', 'name']
                    tools, _ = Template(manifest).constrain_opts(
                        constraints, options)
                    # only one tool in tools because perform this function for
                    # every tool
                    if tools:
                        tool = list(tools.keys())[0]
                        if ('multi_tool' in tools[tool] and
                                tools[tool]['multi_tool'] == 'yes'):
                            name = tools[tool]['name']
                            if name == 'unspecified':
                                name = 'vent'
                            template_path = join(tools[tool]['path'],
                                                 name+'.template')
                        else:
                            template_path = join(tools[tool]['path'],
                                                 'vent.template')
                    else:
                        status = (False, "Couldn't save configuration")
            else:
                fd, template_path = tempfile.mkstemp(suffix='.template')
                options = ['namespace']
                constraints.update({'type': 'registry'})
                tools, _ = Template(manifest).constrain_opts(constraints,
                                                             options)
                if tools:
                    tool = list(tools.keys())[0]
                else:
                    status = (False, "Couldn't save configuration")
            if status[0]:
                try:
                    # save in vent.template
                    with open(template_path, 'w') as f:
                        f.write(config_val)
                    # save in plugin_manifest
                    vent_template = Template(template_path)
                    manifest = Template(manifest)
                    if instances > 1:
                        # add instances as needed
                        for i in range(1, instances + 1):
                            i_section = tool.rsplit(':', 2)
                            i_section[0] += str(i) if i != 1 else ''
                            i_section = ':'.join(i_section)
                            if not manifest.section(i_section)[0]:
                                manifest.add_section(i_section)
                                for val_pair in manifest.section(tool)[1]:
                                    name = val_pair[0]
                                    val = val_pair[1]
                                    if name == 'name':
                                        val += str(i)
                                    elif name == 'last_updated':
                                        val = Timestamp()
                                    elif name == 'running':
                                        val = 'no'
                                    manifest.set_option(i_section, name, val)
                                template_to_manifest(vent_template, manifest,
                                                     i_section, instances)
                            else:
                                settings = manifest.option(i_section,
                                                           'settings')
                                if settings[0]:
                                    settings_dict = json.loads(settings[1])
                                    settings_dict['instances'] = str(instances)
                                    manifest.set_option(i_section, 'settings',
                                                        json.dumps(
                                                            settings_dict))
                                else:
                                    inst = str(instances)
                                    settings_dict = {'instances': inst}
                                    manifest.set_option(i_section, 'settings',
                                                        json.dumps(
                                                            settings_dict))
                    else:
                        try:
                            settings_str = manifest.option(tool, 'settings')[1]
                            settings_dict = json.loads(settings_str)
                            old_instances = int(settings_dict['instances'])
                        except Exception:
                            old_instances = 1
                        template_to_manifest(vent_template, manifest,
                                             tool, old_instances)
                    manifest.write_config()
                    status = (True, manifest)
                except Exception as e:  # pragma: no cover
                    self.logger.error('save_configure error: ' + str(e))
                    status = (False, str(e))
            # close os file handle and remove temp file
            if from_registry or instances > 1:
                try:
                    close(fd)
                    remove(template_path)
                except Exception as e:  # pragma: no cover
                    self.logger.error('save_configure error: ' + str(e))
        else:
            with open(self.vent_config, 'w') as f:
                f.write(config_val)
        return status
897902
function writeBaseConfiguration()
    {
        if (! $this->files->exists($this->path())) {
            $this->write(['tld' => 'test', 'paths' => []]);
        }

        /**
         * Migrate old configurations from 'domain' to 'tld'
         */
        $config = $this->read();

        if (isset($config['tld'])) {
            return;
        }

        $this->updateKey('tld', !empty($config['domain']) ? $config['domain'] : 'test');
    }
316260
def upload_settings():
    ""
    local_path = os.path.join(curdir, 'settings/{0}.py'.format(env.host))
    if os.path.exists(local_path):
        remote_path = os.path.join(env.path, 'varify/conf/local_settings.py')
        put(local_path, remote_path)
    elif not confirm(yellow('No local settings found for host "{0}". Continue anyway?'.format(env.host))):
        abort('No local settings found for host "{0}". Aborting.'.format(env.host))
90359
def save_config(self, cmd="write mem", confirm=False, confirm_response=""):
        """"""
        return super(OneaccessOneOSBase, self).save_config(
            cmd=cmd, confirm=confirm, confirm_response=confirm_response
        )
154150
private static function resetAsseticConfig()
        {

            return;

            /**
             * dev
             */
            $aYaml                              = Yaml::parse(file_get_contents(self::$_container->get('kernel')->getRootDir() . '/config/config_dev.yml'));
            $aYaml['assetic']['use_controller'] = false;
            $sNewYaml                           = Yaml::dump($aYaml, 5);
            file_put_contents(self::$_container->get('kernel')->getRootDir() . '/config/config_dev.yml', $sNewYaml);


            /**
             * prod
             */
            $aYaml                              = Yaml::parse(file_get_contents(self::$_container->get('kernel')->getRootDir() . '/config/config_prod.yml'));
            $aYaml['assetic']['use_controller'] = false;
            $sNewYaml                           = Yaml::dump($aYaml, 5);
            file_put_contents(self::$_container->get('kernel')->getRootDir() . '/config/config_prod.yml', $sNewYaml);
        }