Skip to content

Commit

Permalink
chore: testmode fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KiraLT committed Dec 28, 2022
1 parent 1ba2794 commit 7441c5f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 5 additions & 3 deletions app/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

import shutil
from certbot._internal.plugins import disco as plugins_disco
from os import environ

from app.settings import load_settings
from app.services.certbot import obtain_certbot_certs
from app.services.aws import list_secret_names, upload_certs_as_secrets


def handler(_event, _context):
settings = load_settings()

if settings.TESTMODE:
if environ.get('TESTMODE') == 'true':
plugins = list(plugins_disco.PluginsRegistry.find_all())
dns_plugins = [v for v in plugins if v.startswith('dns-')]

Expand All @@ -20,6 +19,9 @@ def handler(_event, _context):

return
else:
settings = load_settings()


try:
shutil.rmtree(str(settings.CERTBOT_DIR), ignore_errors=True)

Expand Down
2 changes: 0 additions & 2 deletions app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class Settings:
CERTBOT_EXTRA_ARGS: list[str] = None
CERTBOT_CREDENTIALS: str = None
CERTBOT_PROPAGATION_SECONDS: str = None
TESTMODE: bool = False


def read_env(
Expand Down Expand Up @@ -61,5 +60,4 @@ def load_settings() -> Settings:
CERTBOT_EXTRA_ARGS=read_env("CERTBOT_EXTRA_ARGS", multi=True, delimiter=" "),
CERTBOT_CREDENTIALS=read_env("CERTBOT_CREDENTIALS"),
CERTBOT_PROPAGATION_SECONDS=read_env("CERTBOT_PROPAGATION_SECONDS"),
TESTMODE=read_env('TESTMODE') == 'true'
)

0 comments on commit 7441c5f

Please sign in to comment.