ensure the configuration is resolved and ready to use
972293
def init_config
      unless instance_variable_defined? :@hatt_configuration
        @hatt_configuration = TCFG::Base.new

        # build up some default configuration
        @hatt_configuration.tcfg_set 'hatt_services', {}
        @hatt_configuration.tcfg_set 'hatt_globs', DEFAULT_HATT_GLOBS

        @hatt_configuration.tcfg_set_env_var_prefix 'HATT_'
      end

      if hatt_config_file_path
        # if a config file was specified, we assume it exists
        @hatt_configuration.tcfg_config_file hatt_config_file_path
      else
        Log.warn 'No configuration file specified or found. Make a hatt.yml file and point hatt at it.'
      end
      @hatt_configuration.tcfg_set 'hatt_config_file', hatt_config_file_path

      normalize_services_config @hatt_configuration

      nil
    end
1011659
def _setup(self):
        """"""
        default_settings.reload()
        environment_variable = self._kwargs.get(
            "ENVVAR_FOR_DYNACONF", default_settings.ENVVAR_FOR_DYNACONF
        )
        settings_module = os.environ.get(environment_variable)
        self._wrapped = Settings(
            settings_module=settings_module, **self._kwargs
        )
        self.logger.debug("Lazy Settings _setup ...")
1146534
void showFilesConfiguration() {

        // Message to communicate the resolved configuration:
        String message;
        if (filesUrl != null) {
            String reload = filesReloadable ? "reloadable" : "non-reloadable";
            message = "Files will be served from: " + filesUrl + " (" + reload + ")";
        } else {
            message = "No static files will be served.";
        }
        log.info("Files: {}", message);
    }
1254473
def update_configuration(self):
        
        uri = "{}/configuration".format(self.data["uri"])
        result = self._helper.update({}, uri)
        self.refresh()

        return result
1023690
public void finalizeConfig() {
        assert !configFinalized;

        try {
            retrieveEngine();
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage(), e);
        }
        configFinalized = true;
    }
18827
def FinalizeConfigInit(config,
                       token,
                       admin_password = None,
                       redownload_templates = False,
                       repack_templates = True,
                       prompt = True):
  """"""
  config.Set("Server.initialized", True)
  print("\nWriting configuration to %s." % config["Config.writeback"])
  config.Write()
  print("Initializing the datastore.")
  # Reload the config and initialize the GRR database.
  server_startup.Init()

  print("\nStep 3: Adding GRR Admin User")
  try:
    CreateUser("admin", password=admin_password, is_admin=True)
  except UserAlreadyExistsError:
    if prompt:
      # pytype: disable=wrong-arg-count
      if ((builtins.input("User 'admin' already exists, do you want to "
                          "reset the password? [yN]: ").upper() or "N") == "Y"):
        UpdateUser("admin", password=admin_password, is_admin=True)
      # pytype: enable=wrong-arg-count
    else:
      UpdateUser("admin", password=admin_password, is_admin=True)

  print("\nStep 4: Repackaging clients with new configuration.")
  if prompt:
    redownload_templates = RetryBoolQuestion(
        "Server debs include client templates. Re-download templates?", False)
    repack_templates = RetryBoolQuestion("Repack client templates?", True)
  if redownload_templates:
    InstallTemplatePackage()
  # Build debug binaries, then build release binaries.
  if repack_templates:
    repacking.TemplateRepacker().RepackAllTemplates(upload=True, token=token)
  print("\nGRR Initialization complete! You can edit the new configuration "
        "in %s.\n" % config["Config.writeback"])
  print("Please restart the service for the new configuration to take "
        "effect.\n")
1304556
public synchronized void prepareAppRoot(String configureFileName) throws Exception {
		if (!cb.isKernelStartup()) {
			cb.registerAppRoot(configureFileName);
			logger.info(configureFileName + " is ready.");
		}
	}
789557
def prepare(self, configuration_folder, args_dict, environment):
        """"""
        self.configuration_folder = configuration_folder
        if not os.path.isdir(configuration_folder):
            raise BadOption("Specified configuration folder is not a directory!", wanted=configuration_folder)
        available = [os.path.join(configuration_folder, name) for name in os.listdir(configuration_folder)]
        available_environments = [os.path.basename(path) for path in available if os.path.isdir(path)]
        available_environments = [e for e in available_environments if not e.startswith('.')]

        # Make sure the environment exists
        if environment and environment not in available_environments:
            raise BadOption("Specified environment doesn't exist", available=available_environments, wanted=environment)

        if environment:
            environment_files = [os.path.join(configuration_folder, "accounts.yaml")]
            for root, dirs, files in os.walk(os.path.join(configuration_folder, environment)):
                environment_files.extend(os.path.join(root, filename) for filename in files)

            with tempfile.NamedTemporaryFile() as fle:
                contents = json.dumps({"includes": environment_files})
                fle.write(contents.encode('utf-8'))
                fle.flush()
                args_dict['aws_syncr']['environment'] = os.path.split(environment)[-1]
                super(Collector, self).prepare(fle.name, args_dict)
1212092
protected function validateConfiguration()
    {
        if (!$this->environment->load(getcwd() . DIRECTORY_SEPARATOR . 'peridot.php')) {
            fwrite(STDERR, "Configuration file specified but does not exist" . PHP_EOL);
            exit(1);
        }
    }
1362053
def init_config(self, app):
        """"""
        # Set up API endpoints for records.
        for k in dir(config):
            if k.startswith('RECORDS_REST_'):
                app.config.setdefault(k, getattr(config, k))

        # Resolve the Elasticsearch error handlers
        handlers = app.config['RECORDS_REST_ELASTICSEARCH_ERROR_HANDLERS']
        for k, v in handlers.items():
            handlers[k] = obj_or_import_string(v)
604437
def init(ctx, force):
    """"""
    if os.path.exists(PROJECT_CONFIG) and not force:
        click.secho(
            'An existing configuration file was found at "{}".\n'
            .format(PROJECT_CONFIG),
            fg='red', bold=True
        )
        click.secho(
            'Please remove it before in order to run the setup wizard or use\n'
            'the --force flag to overwrite it.'
        )
        ctx.exit(1)

    project_key = click.prompt('Project key on the issue tracker')
    base_branch = click.prompt('Integration branch', default='master')

    virtualenvs = ('.venv', '.env', 'venv', 'env')
    for p in virtualenvs:
        if os.path.exists(os.path.join(p, 'bin', 'activate')):
            venv = p
            break
    else:
        venv = ''
    venv_path = click.prompt('Path to virtual environment', default=venv)

    project_id = click.prompt('Project ID on Harvest', type=int)
    task_id = click.prompt('Task id on Harvest', type=int)

    config = configparser.ConfigParser()

    config.add_section('lancet')
    config.set('lancet', 'virtualenv', venv_path)

    config.add_section('tracker')
    config.set('tracker', 'default_project', project_key)

    config.add_section('harvest')
    config.set('harvest', 'project_id', str(project_id))
    config.set('harvest', 'task_id', str(task_id))

    config.add_section('repository')
    config.set('repository', 'base_branch', base_branch)

    with open(PROJECT_CONFIG, 'w') as fh:
        config.write(fh)

    click.secho('\nConfiguration correctly written to "{}".'
                .format(PROJECT_CONFIG), fg='green')
88603
private void ensureInitialized() {
    if (!mInitialized) {
     lock.lock();
      try {
        if (!mInitialized) {
          mInternalPath = Environment.getDataDirectory();
          mExternalPath = Environment.getExternalStorageDirectory();
          updateStats();
          mInitialized = true;
        }
      } finally {
        lock.unlock();
      }
    }
  }
1259631
def precheck():
    
    cfg_path = local_config['PROJECT']['CONFIG_PATH']
    # enable or disable logging based on config/ defaults
    logging = set_logging(local_config)

    if os.path.exists(cfg_path):
        logger.info('%s: config_path parameter: %s' % (inspect.stack()[0][3], cfg_path))
        logger.info(
            '%s: Existing configuration file found. precheck pass.' %
            (inspect.stack()[0][3]))
        return True
    elif not os.path.exists(cfg_path) and logging is False:
        logger.info(
            '%s: No pre-existing configuration file found at %s. Using defaults. Logging disabled.' %
            (inspect.stack()[0][3], cfg_path)
            )
        return True
    if logging:
        logger.info(
            '%s: Logging enabled per config file (%s).' %
            (inspect.stack()[0][3], cfg_path)
            )
        return True
    return False
1727
function prepareBuild(config) {

  function serve(exitCode) {

    // Save our exitCode for testing
    _exitCode = exitCode;

    // Reset skyuxconfig.json
    resetConfig();

    return server.start('unused-root', tmp)
      .then(port => browser.get(`https://localhost:${port}/dist/`));
  }

  writeConfig(config);

  return new Promise((resolve, reject) => {
    rimrafPromise(path.join(tmp, 'dist'))
      .then(() => exec(`node`, [cliPath, `build`, `--logFormat`, `none`], cwdOpts))
      .then(serve)
      .then(resolve)
      .catch(err => reject(err));
  });
}
536620
public function setupIfNecessary()
    {
        // Check if local is ready for deployment
        return $this->modulable->on('local', function () {
            $primer = $this->modulable->executeTask('Primer');

            return $primer ?: $this->modulable->halt('Project is not ready for deploy. You were almost fired.');
        });

        if (!$this->isSetup()) {
            $this->explainer->error('Server is not ready, running Setup task');

            return $this->modulable->executeTask('Setup');
        }
    }
879475
def main():
    
    setup_main()
    config = ConfigData(clean=True)
    try:
        config.register()
    finally:
        config.clean_after_if_needed()
390209
def check_config(config):
    '''
        
    '''
    # Check server URL
    url = config.get("Server", "url")
    try:
        urlopen(url)
    except Exception as e:
        logger.error(
            "The configured OpenSubmit server URL ({0}) seems to be invalid: {1}".format(url, e))
        return False
    # Check directory specification
    targetdir = config.get("Execution", "directory")
    if platform.system() is not "Windows" and not targetdir.startswith("/"):
        logger.error(
            "Please use absolute paths, starting with a /, in your Execution-directory setting.")
        return False
    if not targetdir.endswith(os.sep):
        logger.error(
            "Your Execution-directory setting must end with a " + os.sep)
        return False
    return True