Skip to content

Commit

Permalink
fix init_app
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenkims committed Jan 13, 2022
1 parent ca97156 commit e73a46c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
15 changes: 0 additions & 15 deletions init_app.py
Expand Up @@ -53,23 +53,8 @@ def add_sl_domains():
Session.commit()


def add_invalid_mailbox_domains(disposable_domains_file_path):
with open(disposable_domains_file_path, "r") as f:
disposable_email_domains = f.readlines()
disposable_email_domains = [d.strip().lower() for d in disposable_email_domains]
disposable_email_domains = [
d for d in disposable_email_domains if not d.startswith("#")
]

for domain in disposable_email_domains:
if InvalidMailboxDomain.get_by(domain=domain) is None:
LOG.i("Add disposable domain %s as invalid mailbox domain", domain)
InvalidMailboxDomain.create(domain=domain, commit=True)


if __name__ == "__main__":
# wrap in an app context to benefit from app setup like database cleanup, sentry integration, etc
with create_light_app().app_context():
load_pgp_public_keys()
add_sl_domains()
add_invalid_mailbox_domains()
2 changes: 1 addition & 1 deletion monitoring.py
Expand Up @@ -32,7 +32,7 @@ def log_postfix_metrics():


def nb_files(directory) -> int:
"""return the number of files in directory and its sub-directories"""
"""return the number of files in directory and its subdirectories"""
return sum(len(files) for _, _, files in os.walk(directory))


Expand Down

0 comments on commit e73a46c

Please sign in to comment.