Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Slim down IoC interface (#247)
  • Loading branch information
c-w committed Jan 21, 2020
1 parent c73bfb6 commit 7b40bad
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions opwen_email_client/webapp/ioc.py
Expand Up @@ -19,21 +19,6 @@


class Ioc:
@cached_property
def serializer(self):
return JsonSerializer()

@cached_property
def email_server_client(self):
if AppConfig.TESTING:
return LocalEmailServerClient()

return HttpEmailServerClient(
compression=AppConfig.COMPRESSION,
hostname=AppConfig.EMAIL_SERVER_HOSTNAME,
client_id=AppConfig.CLIENT_ID,
)

@cached_property
def email_store(self):
return SqliteEmailStore(
Expand All @@ -44,14 +29,25 @@ def email_store(self):

@cached_property
def email_sync(self):
if AppConfig.TESTING:
email_server_client = LocalEmailServerClient()
else:
email_server_client = HttpEmailServerClient(
compression=AppConfig.COMPRESSION,
hostname=AppConfig.EMAIL_SERVER_HOSTNAME,
client_id=AppConfig.CLIENT_ID,
)

serializer = JsonSerializer()

return AzureSync(
compression=AppConfig.COMPRESSION,
account_name=AppConfig.STORAGE_ACCOUNT_NAME,
account_key=AppConfig.STORAGE_ACCOUNT_KEY,
email_server_client=self.email_server_client,
email_server_client=email_server_client,
container=AppConfig.STORAGE_CONTAINER,
provider=AppConfig.STORAGE_PROVIDER,
serializer=self.serializer,
serializer=serializer,
)

@cached_property
Expand Down

0 comments on commit 7b40bad

Please sign in to comment.