예제 #1
0
    def factory(self) -> ComponentFactory:
        """A factory for constructing Gafaelfawr components.

        This is constructed on the fly at each reference to ensure that we get
        the latest logger, which may have additional bound context.
        """
        return ComponentFactory(
            config=self.config,
            redis=self.redis,
            session=db.session,
            http_client=self.http_client,
            logger=self.logger,
        )
예제 #2
0
파일: setup.py 프로젝트: yee379/gafaelfawr
    def factory(self) -> ComponentFactory:
        """Return a `~gafaelfawr.factory.ComponentFactory`.

        Build a new one each time to ensure that it picks up the current
        configuration information.

        Returns
        -------
        factory : `gafaelfawr.factory.ComponentFactory`
            Newly-created factory.
        """
        return ComponentFactory(
            config=self.config,
            redis=self.redis,
            http_client=self.client,
            session=self.session,
            logger=self.logger,
        )