Skip to content

Commit

Permalink
🎨 Fix merge conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: ff137 <[email protected]>
  • Loading branch information
ff137 committed Nov 27, 2024
1 parent e6d54c5 commit 1ca5f26
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 122 deletions.
18 changes: 15 additions & 3 deletions acapy_agent/config/default_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from ..anoncreds.registry import AnonCredsRegistry
from ..cache.base import BaseCache
from ..cache.in_memory import InMemoryCache
from ..config.logging.utils import add_trace_level
from ..core.event_bus import EventBus
from ..core.goal_code_registry import GoalCodeRegistry
from ..core.plugin_registry import PluginRegistry
Expand All @@ -29,17 +28,22 @@
from .injection_context import InjectionContext
from .provider import CachedProvider, ClassProvider

LOGGER = logging.getLogger(__name__)


class DefaultContextBuilder(ContextBuilder):
"""Default context builder."""

async def build_context(self) -> InjectionContext:
"""Build the base injection context; set DIDComm prefix to emit."""
LOGGER.debug("Building new injection context")

context = InjectionContext(settings=self.settings)
context.settings.set_default("default_label", "Aries Cloud Agent")

if context.settings.get("timing.enabled"):
timing_log = context.settings.get("timing.log_file")
LOGGER.debug("Enabling timing collector with log file: %s", timing_log)
collector = Collector(log_path=timing_log)
context.injector.bind_instance(Collector, collector)

Expand Down Expand Up @@ -81,18 +85,21 @@ async def build_context(self) -> InjectionContext:

async def bind_providers(self, context: InjectionContext):
"""Bind various class providers."""
LOGGER.debug("Begin binding providers to context")

context.injector.bind_provider(ProfileManager, ProfileManagerProvider())

wallet_type = self.settings.get("wallet.type")
if wallet_type == "askar-anoncreds":
LOGGER.debug("Using AnonCreds tails server")
context.injector.bind_provider(
BaseTailsServer,
ClassProvider(
"acapy_agent.tails.anoncreds_tails_server.AnonCredsTailsServer",
),
)
else:
LOGGER.debug("Using Indy tails server")
context.injector.bind_provider(
BaseTailsServer,
ClassProvider(
Expand All @@ -115,6 +122,7 @@ async def bind_providers(self, context: InjectionContext):
async def load_plugins(self, context: InjectionContext):
"""Set up plugin registry and load plugins."""

LOGGER.debug("Initializing plugin registry")
plugin_registry = PluginRegistry(
blocklist=self.settings.get("blocked_plugins", [])
)
Expand Down Expand Up @@ -152,8 +160,10 @@ async def load_plugins(self, context: InjectionContext):
"acapy_agent.revocation",
]

def register_askar_plugins():
for plugin in askar_plugins:
def register_plugins(plugins: list[str], plugin_type: str):
"""Register a group of plugins with logging."""
LOGGER.debug("Registering %s plugins", plugin_type)
for plugin in plugins:
plugin_registry.register_plugin(plugin)

def register_askar_plugins():
Expand All @@ -165,6 +175,7 @@ def register_anoncreds_plugins():
register_plugins(default_plugins, "default")

if context.settings.get("multitenant.admin_enabled"):
LOGGER.debug("Multitenant admin enabled - registering additional plugins")
plugin_registry.register_plugin("acapy_agent.multitenant.admin")
register_askar_plugins()
register_anoncreds_plugins()
Expand All @@ -176,6 +187,7 @@ def register_anoncreds_plugins():

# Register external plugins
for plugin_path in self.settings.get("external_plugins", []):
LOGGER.debug("Registering external plugin: %s", plugin_path)
plugin_registry.register_plugin(plugin_path)

# Register message protocols
Expand Down
7 changes: 0 additions & 7 deletions acapy_agent/config/logging/configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@
from .timed_rotating_file_multi_process_handler import (
TimedRotatingFileMultiProcessHandler,
)
from .utils import add_trace_level


LOGGER = logging.getLogger(__name__)

# Add TRACE level to logging before any configuration
add_trace_level()

LOGGER = logging.getLogger(__name__)

Expand Down
102 changes: 0 additions & 102 deletions acapy_agent/config/logging/utils.py

This file was deleted.

8 changes: 1 addition & 7 deletions acapy_agent/core/conductor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
load_multiple_genesis_transactions_from_config,
)
from ..config.logging import LoggingConfigurator
from ..config.logging.utils import add_trace_level
from ..config.provider import ClassProvider
from ..config.wallet import wallet_config
from ..core.profile import Profile
Expand Down Expand Up @@ -83,8 +82,6 @@
from .util import SHUTDOWN_EVENT_TOPIC, STARTUP_EVENT_TOPIC

LOGGER = logging.getLogger(__name__)
add_trace_level() # Allow trace logs from this module

# Refer ACA-Py issue #2197
# When the from version is not found
DEFAULT_ACAPY_VERSION = "v0.7.5"
Expand Down Expand Up @@ -364,6 +361,7 @@ async def start(self) -> None:

# Get agent label
default_label = context.settings.get("default_label")
public_did = self.setup_public_did and self.setup_public_did.did
LOGGER.debug("Agent label: %s", default_label)

if context.settings.get("log.banner", True):
Expand Down Expand Up @@ -531,7 +529,6 @@ async def start(self) -> None:
qr.add_data(invite_url)
qr.print_ascii(invert=True)
del mgr
LOGGER.trace("Invitation created and QR code printed.")
except Exception:
LOGGER.exception("Error creating invitation.")

Expand All @@ -558,9 +555,6 @@ async def start(self) -> None:
qr.add_data(invite_url)
qr.print_ascii(invert=True)
del mgr
LOGGER.trace(
"Connections protocol invitation created and QR code printed."
)
except Exception:
LOGGER.exception("Error creating connections protocol invitation.")

Expand Down
2 changes: 0 additions & 2 deletions acapy_agent/core/plugin_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
from typing import Optional, Sequence, Set

from ..config.injection_context import InjectionContext
from ..config.logging.utils import add_trace_level
from ..core.event_bus import EventBus
from ..utils.classloader import ClassLoader, ModuleLoadError
from .error import ProtocolDefinitionValidationError
from .goal_code_registry import GoalCodeRegistry
from .protocol_registry import ProtocolRegistry

LOGGER = logging.getLogger(__name__)
add_trace_level() # Allow trace logs from this module


class PluginRegistry:
Expand Down
1 change: 0 additions & 1 deletion acapy_agent/utils/classloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from types import ModuleType
from typing import Optional, Sequence, Type

from ..config.logging.utils import add_trace_level
from ..core.error import BaseError

LOGGER = logging.getLogger(__name__)
Expand Down

0 comments on commit 1ca5f26

Please sign in to comment.