diff --git a/.github/CODEOWNERS b/.archive/.github/CODEOWNERS similarity index 100% rename from .github/CODEOWNERS rename to .archive/.github/CODEOWNERS diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.archive/.github/ISSUE_TEMPLATE/bug_report.md similarity index 100% rename from .github/ISSUE_TEMPLATE/bug_report.md rename to .archive/.github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.archive/.github/ISSUE_TEMPLATE/feature_request.md similarity index 100% rename from .github/ISSUE_TEMPLATE/feature_request.md rename to .archive/.github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/dependabot.yml b/.archive/.github/dependabot.yml similarity index 100% rename from .github/dependabot.yml rename to .archive/.github/dependabot.yml diff --git a/.github/renovate.json b/.archive/.github/renovate.json similarity index 100% rename from .github/renovate.json rename to .archive/.github/renovate.json diff --git a/.github/workflows-old/release.yml b/.archive/.github/workflows-old/release.yml similarity index 100% rename from .github/workflows-old/release.yml rename to .archive/.github/workflows-old/release.yml diff --git a/.github/workflows/ci.yml b/.archive/.github/workflows/ci.yml similarity index 100% rename from .github/workflows/ci.yml rename to .archive/.github/workflows/ci.yml diff --git a/.github/workflows/release.yml b/.archive/.github/workflows/release.yml similarity index 100% rename from .github/workflows/release.yml rename to .archive/.github/workflows/release.yml diff --git a/.env.default b/.env.default index 0d6cd03..f92ec40 100644 --- a/.env.default +++ b/.env.default @@ -5,5 +5,6 @@ APPROVED_DOMAINS="example.com,hello.com" APPROVED_ROOMS="abc123,def456" APPROVED_USERS="bob@example.com,john@me.com" BOT_NAME="" -N8N_WEBHOOK_URL="" +N8N_GET_WEBHOOK_URL="" +N8N_POST_WEBHOOK_URL="" WEBEX_API_KEY="" diff --git a/app/utils/config.py b/app/utils/config.py index 629adc9..b277dbb 100644 --- a/app/utils/config.py +++ b/app/utils/config.py @@ -42,9 +42,14 @@ class Config: return os.environ["ADMIN_EMAIL"].split(",") @property - def n8n_webhook_url(self) -> str: - """Returns the n8n webhook URL.""" - return os.environ["N8N_WEBHOOK_URL"] + def n8n_get_webhook_url(self) -> str: + """Returns the n8n GET webhook URL.""" + return os.environ["N8N_GET_WEBHOOK_URL"] + + @property + def n8n_post_webhook_url(self) -> str: + """Returns the n8n POST webhook URL.""" + return os.environ["N8N_POST_WEBHOOK_URL"] @property def approved_users(self) -> list: diff --git a/app/utils/n8n.py b/app/utils/n8n.py index 42fd030..f57e0ff 100644 --- a/app/utils/n8n.py +++ b/app/utils/n8n.py @@ -16,7 +16,7 @@ def __n8n_post(data: dict) -> bool: """ headers: dict = {"Content-Type": "application/json"} resp: requests.Response = requests.post( - url=config.n8n_webhook_url, + url=config.n8n_post_webhook_url, headers=headers, json=data, timeout=10, @@ -58,7 +58,7 @@ def get_tasks(requestor) -> bool: """ headers: dict = {"Content-Type": "application/json"} resp: requests.Response = requests.get( - url=config.n8n_webhook_url, + url=config.n8n_get_webhook_url, headers=headers, timeout=10, verify=True, diff --git a/tests/test_config_1.py b/tests/test_config_1.py index d694f29..dd51a55 100644 --- a/tests/test_config_1.py +++ b/tests/test_config_1.py @@ -16,7 +16,8 @@ def test_config() -> None: "WEBEX_API_KEY": "testing", "ADMIN_FIRST_NAME": "Test", "ADMIN_EMAIL": "test@test.com", - "N8N_WEBHOOK_URL": "https://n8n.test.com/webhook/abcdefg", + "N8N_GET_WEBHOOK_URL": "https://n8n.test.com/webhook/abc", + "N8N_POST_WEBHOOK_URL": "https://n8n.test.com/webhook/def", "APPROVED_USERS": "test@test.com", "APPROVED_DOMAINS": "test.com", "APPROVED_ROOMS": "test", @@ -34,7 +35,8 @@ def test_config() -> None: assert config.approved_rooms == config_vars["APPROVED_ROOMS"].split(",") assert config.approved_users == config_vars["APPROVED_USERS"].split(",") assert config.bot_name == config_vars["BOT_NAME"] - assert config.n8n_webhook_url == config_vars["N8N_WEBHOOK_URL"] + assert config.n8n_get_webhook_url == config_vars["N8N_GET_WEBHOOK_URL"] + assert config.n8n_post_webhook_url == config_vars["N8N_POST_WEBHOOK_URL"] assert config.version == config_vars["APP_VERSION"] assert config.webex_token == config_vars["WEBEX_API_KEY"] diff --git a/tests/test_config_2.py b/tests/test_config_2.py index b4247d3..26f8595 100644 --- a/tests/test_config_2.py +++ b/tests/test_config_2.py @@ -16,7 +16,8 @@ def test_config_no_admin_vars() -> None: "WEBEX_API_KEY": "testing", "ADMIN_FIRST_NAME": "Test", "ADMIN_EMAIL": "test@test.com", - "N8N_WEBHOOK_URL": "https://n8n.test.com/webhook/abcdefg", + "N8N_GET_WEBHOOK_URL": "https://n8n.test.com/webhook/abc", + "N8N_POST_WEBHOOK_URL": "https://n8n.test.com/webhook/def", } for config_var, value in config_vars.items(): @@ -31,7 +32,8 @@ def test_config_no_admin_vars() -> None: assert config.admin_emails == config_vars["ADMIN_EMAIL"].split(",") assert config.admin_first_name == config_vars["ADMIN_FIRST_NAME"] assert config.bot_name == config_vars["BOT_NAME"] - assert config.n8n_webhook_url == config_vars["N8N_WEBHOOK_URL"] + assert config.n8n_get_webhook_url == config_vars["N8N_GET_WEBHOOK_URL"] + assert config.n8n_post_webhook_url == config_vars["N8N_POST_WEBHOOK_URL"] assert config.version == config_vars["APP_VERSION"] assert config.webex_token == config_vars["WEBEX_API_KEY"]