Create service config.
421382
protected function createServiceConfig(string $name): array
    {
        $config = [];
        if ($this->has($name)) {
            $config = $this->config[$name];
        }

        $class = $name;

        if (isset($config['use'])) {
            if (!is_string($config['use'])) {
                throw new Exception\InvalidConfiguration('use must be a string for service '.$name);
            }

            $class = $config['use'] = $this->getEnv($config['use']);
        }

        if (preg_match('#^\{([^{}]+)\}$#', $class)) {
            $config = array_merge($this->getServiceDefaults(), $config);

            return $config;
        }

        $config = $this->mergeServiceConfig($name, $class, $config);

        if (isset($config['use'])) {
            $class = $config['use'] = $this->getEnv($config['use']);
        }

        if (!class_exists($class)) {
            throw new Exception\InvalidConfiguration('class '.$class.' is either not a class or can not be found');
        }

        return $config;
    }
794097
def write_config(self):
        """"""
        config_file = os.path.join(self.config_dir, 'pueue.ini')
        with open(config_file, 'w') as file_descriptor:
            self.config.write(file_descriptor)
1094344
public B service(PathMapping pathMapping, Service<HttpRequest, HttpResponse> service) {
        services.add(new ServiceConfig(pathMapping, service, null));
        return self();
    }
301749
protected function loadServicesFromConfig()
    {
        foreach (Config::get('services', []) as $name => $service) {
            $service += [
                'shared' => false,
                'locked' => false,
                'definition' => []
            ];

            $this->container->set($name, $service['definition'], $service['shared'], $service['locked']);
        }
    }
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)
1243545
def _create_run_config(options):
        """"""
        values = {opt: getattr(options, opt) for opt in
                       RunConfiguration._fields}
        return RunConfiguration(**values)
168428
def _create_main_config(cls, overrides=None):
        """"""
        filepaths = []
        filepaths.append(get_module_root_config())
        filepath = os.getenv("REZ_CONFIG_FILE")
        if filepath:
            filepaths.extend(filepath.split(os.pathsep))

        filepath = os.path.expanduser("~/.rezconfig")
        filepaths.append(filepath)

        return Config(filepaths, overrides)
1031443
private function configure(): void
    {
        $services = array_keys($this->container->findTaggedServiceIds('app.service'));
        foreach ($services as $service) {
            $service = $this->container->get($service);
            $this->services[$service->getName()] = $service;
        }
    }
732281
def _create_service(self, parameters={}, **kwargs):
        
        logging.debug("_create_service()")
        logging.debug(str.join(',', [self.service_name, self.plan_name,
            self.name, str(parameters)]))

        return self.service.create_service(self.service_name, self.plan_name,
                self.name, parameters, **kwargs)
141395
function configure(name, service) {
	if (!name) {
		throw new Error('Please specify a name for the client');
	}
	if (name === 'configure' || name === 'client') {
		throw new Error('Cannot register service with reserved name: ' + name);
	}
	module.exports[name] = new Client(service);
}
206660
protected void setConfigurationService(ConfigurationService configService) {
        if (log.isLoggable(Level.FINER)) {
            log.finer("Set configuration service = " + configService);
        }

        configurationService = configService;

        if (configurationService != null) {
            initConfig();
        }
    }
1341155
private function buildServiceConfig()
    {
        if ($this->serviceConfig->keyExists('Factory') && !$this->serviceConfig->keyExists('Method')) {
            throw new ServiceManagerException(ServiceManagerException::FACTORY_SERVICE_METHOD_KEY_MISSING,
                                              [$this->serviceName]
            );
        }

        $config = new ServiceConfig();
        $config->setClass($this->serviceConfig->key('Class', null, true));
        $config->setArguments($this->serviceConfig->key('Arguments', [], true));
        $config->setCalls($this->serviceConfig->key('Calls', [], true));
        $config->setScope($this->serviceConfig->key('Scope', ServiceScope::CONTAINER, true));
        $config->setFactory($this->serviceConfig->key('Factory', null, true));
        $config->setMethod($this->serviceConfig->key('Method', null, true));
        $config->setMethodArguments($this->serviceConfig->key('MethodArguments'));
        $config->setStatic($this->serviceConfig->key('Static', true, true));

        return $config;
    }
1199090
public function setupService($service, array $config)
    {
        $app = $this->getApp();

        $app->container->set(
            '@' . $service,
            new ServiceDefinition($this, $service, $config)
        );
    }
44486
private function manageInheritance()
    {
        $config = $this->serviceConfig;
        if ($config->keyExists('Parent')) {
            $parentServiceName = $this->str($config->key('Parent'))->trimLeft('@')->val();
            $parentConfig = ServiceManager::getInstance()->getServiceConfig($parentServiceName)->toArray(true);
            if (!$parentConfig->keyExists('Abstract')) {
                throw new ServiceManagerException(ServiceManagerException::SERVICE_IS_NOT_ABSTRACT,
                                                  [$config->key('Parent')]
                );
            }
            $config = $this->extendConfig($config, $parentConfig);
        }

        // Check if it's a potentially valid service definition
        if (!$config->keyExists('Class') && !$config->keyExists('Factory')) {
            throw new ServiceManagerException(ServiceManagerException::SERVICE_CLASS_KEY_NOT_FOUND,
                                              [$this->serviceName]
            );
        }

        $this->serviceConfig = $config;
    }
1286744
def create(self):
        
        self.service.create()

        predix.config.set_env_value(self.use_class, 'ingest_uri',
                self.get_ingest_uri())
        predix.config.set_env_value(self.use_class, 'ingest_zone_id',
                self.get_ingest_zone_id())

        predix.config.set_env_value(self.use_class, 'query_uri',
                self.get_query_uri())
        predix.config.set_env_value(self.use_class, 'query_zone_id',
                self.get_query_zone_id())
282713
def create(self):
        
        self.service.create()
        os.environ[self.__module__ + '.uri'] = self.service.settings.data['url']
        os.environ[self.__module__ + '.zone_id'] = self.get_predix_zone_id()
354202
def create_services(self, compose_str: str) -> list:
        
        # Raise an exception if we are not a manager
        if not self._manager:
            raise RuntimeError('Services can only be run on '
                               'swarm manager nodes')

        # Initialise empty list
        services_ids = []

        try:
            service_config = yaml.load(compose_str)

            # Deepcopy the service config
            service_list = copy.deepcopy(service_config)

            # Removing version and service from the dict
            service_config.pop('version')
            service_config.pop('services')

            for service_name in service_list['services']:
                service_exist = self._client.services.list(
                    filters={'name': service_name})
                if not service_exist:
                    service_config['name'] = service_name
                    service_spec = self._parse_services(
                        service_config, service_name, service_list)
                    created_service = self._client.services.create(
                        **service_spec)
                    service_id = created_service.short_id
                    LOG.debug('Service created: %s', service_id)
                    services_ids.append(service_id)
                else:
                    LOG.debug('Services already exists')

        except yaml.YAMLError as exc:
            print(exc)

        # Returning list of services created
        return services_ids