def configure(self, config: ConfigParams):
        """
        Configures component by passing configuration parameters.

        :param config: configuration parameters to be set.
        """
        super().configure(config)

        self.__connection_resolver.configure(config)

        self.__index = config.get_as_string_with_default('index', self.__index)
        self._date_format = config.get_as_string_with_default(
            'date_format', self._date_format)
        self.__daily_index = config.get_as_boolean_with_default(
            'daily', self.__daily_index)
        self.__reconnect = config.get_as_integer_with_default(
            'options.reconnect', self.__reconnect)
        self.__timeout = config.get_as_integer_with_default(
            'options.timeout', self.__timeout)
        self.__max_retries = config.get_as_integer_with_default(
            'options.max_retries', self.__max_retries)
        self.__index_message = config.get_as_boolean_with_default(
            'options.index_message', self.__index_message)
        self.__include_type_name = config.get_as_boolean_with_default(
            'options.include_type_name', self.__include_type_name)
    def configure(self, config: ConfigParams):
        """
        Configures this HttpEndpoint using the given configuration parameters.
        - connection(s) - the connection resolver's connections;
            - "connection.discovery_key" - the key to use for connection resolving in a discovery service;
            - "connection.protocol" - the connection's protocol;
            - "connection.host" - the target host;
            - "connection.port" - the target port;
            - "connection.uri" - the target URI.

        :param config: configuration parameters, containing a "connection(s)" section.
        """
        config = config.set_defaults(self._default_config)
        self.__connection_resolver.configure(config)

        bottle.BaseRequest.MEMFILE_MAX = config.get_as_long(
            'options.request_max_size')
        self.__file_max_size = config.get_as_long_with_default(
            'options.file_max_size', self.__file_max_size)
        self.__maintenance_enabled = config.get_as_boolean_with_default(
            'options.maintenance_enabled', self.__maintenance_enabled)
        self.__protocol_upgrade_enabled = config.get_as_boolean_with_default(
            'options.protocol_upgrade_enabled',
            self.__protocol_upgrade_enabled)
        self._debug = config.get_as_boolean_with_default(
            'options.debug', self._debug)

        headers = config.get_as_string_with_default("cors_headers",
                                                    "").split(",")
        for header in headers:
            if header != '':
                self.__allowed_headers = list(
                    filter(lambda h: h != header, self.__allowed_headers))
                self.__allowed_headers.append(header)

        origins = config.get_as_string_with_default("cors_origins",
                                                    "").split(',')
        for origin in origins:
            origin = origin.strip()
            if origin != '':
                self.__allowed_origins = list(
                    filter(lambda h: h != origin, self.__allowed_origins))
                self.__allowed_origins.append(origin)
Exemple #3
0
    def configure(self, config: ConfigParams):
        """
        Configures component by passing configuration parameters.

        :param config: configuration parameters to be set.
        """
        super().configure(config)

        self._auto_subscribe = config.get_as_boolean_with_default(
            "options.autosubscribe", self._auto_subscribe)
    def configure(self, config: ConfigParams):
        """
        Configures component by passing configuration parameters.

        :param config: configuration parameters to be set.
        """
        super().configure(config)

        self._swagger_auto = config.get_as_boolean_with_default(
            'swagger.auto', self._swagger_auto)
    def configure(self, config: ConfigParams):
        config = config.set_defaults(SessionsOperationsV1.__default_config)
        self._dependency_resolver.configure(config)

        self.__cookie_enabled = config.get_as_boolean_with_default(
            'options.cookie_enabled', self.__cookie_enabled)
        self.__cookie = config.get_as_string_with_default(
            'options.cookie', self.__cookie)
        self.__max_cookie_age = config.get_as_long_with_default(
            'options.max_cookie_age', self.__max_cookie_age)