尚未检测到更新。GitHub 发布版本后会显示在这里。
个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
在项目文件夹中运行 /nomorevibe verify,即可验证所有权并自行管理介绍。
一分钟完成验证GC Notify API | GC Notification API
翻译准备中
取自仓库 README
正在加载完整 README。 以下为已保存的摘录。
Contains:
• the public-facing REST API for Notification built on the GOV.UK Notify platform, which teams can integrate with using their clients
• an internal-only REST API built using Flask to manage services, users, templates, etc (this is what the admin app talks to)
• asynchronous workers built using Celery to put things into queues and read them off to be processed, sent to providers, updated, etc
• We currently do not support sending of letters
• We currently do not receive a response if text messages were delivered or not查看完整 README ↗Contains:
For any issues during the following instructions, make sure to review the Frequent problems section toward the end of the document.
brew install --cask visual-studio-code
brew install --cask docker
Install the Remote-Containers extension
Ensure your host ~/.aws/config contains the notify-staging AWS SSO profile, then in VS Code run "Remote-Containers: Open Folder in Container..." and select this repository folder. Rebuild and reopen the devcontainer after adding or changing the profile so the updated configuration is mounted into the container.
(Optional) If you already have the vs-code-agent-feedback repository checked out locally and want it mounted inside the container, copy .devcontainer/devcontainer.local.example.json to a new file named devcontainer.local.json inside the same folder, adjust the source path if needed, and reopen the devcontainer. The mount will only be applied when that local override file exists.
Find and update the .env file from the root of your workspace. Copy and paste the contents of the api .env item from the CDS Platform - Notify Local vault in 1password
Run the service
make run
The API and local worker targets log in with the notify-staging AWS SSO profile by default. For CI environments that provide AWS credentials directly, use make run-ci and make run-celery-local-filtered-ci; these targets do not run SSO login and unset AWS_PROFILE so the AWS SDK uses the environment credentials.
Run make run-celery-local or make run-celery-local-filtered. Note that the "filtered" option does not show the beat worker logs nor most scheduled tasks (this makes it easier to trace notification sending).
This codebase is Python 3 only. At the moment we run 3.12.7 in production. You will run into problems if you try to use Python 3.4 or older.
Ask your teamate for the following keys and add to .env
PERF_TEST_AUTH_HEADER =
PERF_TEST_BULK_EMAIL_TEMPLATE_ID=
PERF_TEST_EMAIL_WITH_LINK_TEMPLATE_ID=
PERF_TEST_EMAIL_TEMPLATE_ID=
PERF_TEST_EMAIL_WITH_ATTACHMENT_TEMPLATE_ID=
PERF_TEST_SMS_TEMPLATE_ID =
And run the performance tests using. We generally test with 3000 users every 20 seconds (but use your best judgement).
locust -f tests-perf/locust/locust-notifications.py
poetry.lock file is generated from the pyproject.toml in order to pin
versions of all nested dependencies. If pyproject.toml has been changed (or
we want to update the unpinned nested dependencies) poetry.lock should be
regenerated with
poetry lock --no-update
poetry.lock should be committed alongside pyproject.toml changes.
Jinja templates used in this repo: email_template.jinja2
Jinja templates are pulled in from the notification-utils repo. To test jinja changes locally (without needing to update the upstream), follow this procedure:
Create a jinja_templates folder in the project root directory. This folder name is already gitignored and won't be tracked.
Copy the jinja template files from notification-utils into the jinja_templates folder created in step 1
Set a new .ENV variable: USE_LOCAL_JINJA_TEMPLATES=True
Make markup changes, and see them locally!
When finished, copy any changed jinja files back to notification-utils, and push up the PR for your changes in that repo.
Remove USE_LOCAL_JINJA_TEMPLATES=True from your .env file, and delete any jinja in jinja_templates. Deleting the folder and jinja files is not required, but recommended. Make sure you're pulling up-to-date jinja from notification-utils the next time you need to make changes.
To help debug full code paths of emails and SMS, we have a special email and phone number set in the application's configuration. As it stands at the moment these are the following:
| Notification Type | Test destination |
|---|---|
| [email protected] | |
| SMS | +16135550123 |
Whereas the smoke test emails and long codes might not get through the whole GCNotify data treatment, these will and have proper database fields populated. This is useful for proper stress tests where the notifications shouldn't merely touch the API front-door but also get through the Celery workers processing.
Problem: No postgres role exists.
Solution: If the command complains you don't have a postgres role existing, execute the following command and retry the above afterward:
createuser -l -s postgres
Problem : E999 SyntaxError: invalid syntax when running flake8
Solution : Check that you are in your correct virtualenv, with python 3.12
Problem: ImportError: failed to find libmagic. Check your installation
Solution:Install libmagic, ex: brew install libmagic
Problem: assert 'test_notification_api' in db.engine.url.database, 'dont run tests against main db
Solution: Do not specify a database in your .env
Problem: sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) fe_sendauth: no password supplied
Solution: Ensure SQLALCHEMY_DATABASE_URI supplied in pytest.ini or your .env file is valid to your
local database with user access, (pytest.ini takes precedence)
Problem: Messages are in the queue but not sending
Solution: Check that celery is running.