41 Commits

Author SHA1 Message Date
Kenneth Kehl
1ecb747c6d reformat 2023-08-29 14:54:30 -07:00
Kenneth Kehl
b59e4df06d code review feedback 2023-05-05 08:09:15 -07:00
Ryan Ahearn
84e7e9b5cf Use credentials output by terraform/development 2023-03-13 13:44:10 -04:00
Ryan Ahearn
28f8649444 Use sns credentials from VCAP_SERVICES 2023-02-28 16:50:00 -05:00
Ryan Ahearn
d1c03e5e8c Get SES config from VCAP_SERVICES 2023-01-31 17:27:17 -05:00
Ryan Ahearn
6868daad90 Replace direct access of os.environ with getenv() 2022-11-01 11:44:30 -04:00
Ryan Ahearn
b4256d0a6c Properly set database connection string in cloud.gov 2022-11-01 11:34:00 -04:00
Ryan Ahearn
41a52daca0 Clean up bucket settings 2022-10-31 15:37:12 -04:00
Steven Reilly
d37c2a53b8 Merge branch 'main' into stvnrlly-remove-broadcasts 2022-10-25 10:17:49 -04:00
stvnrlly
d4e156e8ae Merge branch 'main' into stvnrlly-remove-broadcasts 2022-10-20 19:44:20 -04:00
stvnrlly
e9fdfd59f4 clean flake8 except provider code 2022-10-19 16:16:26 +00:00
stvnrlly
53204c307b tests are, uh, mostly passing 2022-10-05 01:12:35 +00:00
Jim Moffet
d0bba8a8bd Merge branch 'main' into jim/091422/deliverycallbacks 2022-09-30 11:21:46 -04:00
Ryan Ahearn
d37b8b841e Update redis url to use rediss protocol 2022-09-29 10:41:48 -04:00
Ryan Ahearn
538d2cbe4c Proactively specify aws region for s3 operations 2022-09-26 10:56:59 -04:00
jimmoffet
ea3eefa81c test branch for notify-api-alt temporary deploy 2022-09-23 11:56:39 -07:00
Ryan Ahearn
8ede076708 Use correct access credentials for each bucket 2022-09-22 12:14:25 -04:00
Ryan Ahearn
e9815a6f8e Create s3 buckets via terraform and bind to app 2022-09-21 11:22:55 -04:00
Christa Hartsock
e773f937ed WIP: local deployment 2022-06-23 13:39:05 -07:00
Leo Hemsted
0457850fc0 Remove redundant conditional for CF Redis
This is now used in all environments and we've removed support for
non-CF Redis.
2022-04-20 11:41:33 +01:00
Ben Thorner
95c5f0c079 Remove redundant CloudFoundry config code
These env vars can be set directly in the manifest, like we do for
Template Preview [^1].

[^1]: c08036189b/manifest.yml.j2 (L23-L26)
2022-04-13 14:46:52 +01:00
Ben Thorner
fb405977fa Allow REDIS_URL to optionally come from PaaS
This is to support a migration from Redislabs to PaaS native Redis,
allowing us to toggle between old and new using the env vars for
the instance - without needing to change the code.
2022-04-12 14:48:08 +01:00
Rebecca Law
590f29b28a SQLAlchemy 1.4 requires SQLALCHEMY_DATABASE_URI to use postgresql rather than postgres for the connection uri to the database.
When deploying to paas the database postgres environment variables are set using VCAP_SERVICES provided by PaaS. When we start up the app and set the properties we need to replace the postgres string with postgresql for the app to start up properly.
This wasn't caught locally or with the unit tests because we were setting this property with postgresql.
2021-04-29 13:49:37 +01:00
Ben Thorner
a91fde2fda Run auto-correct on app/ and tests/ 2021-03-12 11:45:45 +00:00
Toby Lorne
31f845bbff Revert "Specify sslmode in Cloud Foundry environment variables" 2020-11-09 12:04:40 +00:00
Toby Lorne
cfcc3128c2 db: specify sslmode in Cloud Foundry env
Refer to
https://www.postgresql.org/docs/11/libpq-connect.html#LIBPQ-CONNECT-SSLMODE

GOV.UK PaaS gives us the database URI, and we use the default mode of
postgres auth which prefers a TLS connection instead of a plain TCP
connection

We are now specifying the SSL mode in the URI when establishing our
connection to the database, so that:

* We will not connect to the database via a plaintext connection
* We will verify the database connection against a list of trusted CAs

The RDS CA from which the database's certificate is issued is added into
the Cloud Foundry app container via
925681f19b/manifests/cf-manifest/operations.d/350-diego-cell.yml (L17-L22)

Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
Co-authored-by: David <david.mcdonald@digital.cabinet-office.gov.uk>
2020-11-09 10:47:44 +00:00
Alexey Bezhan
e02c8339e7 Remove cloudfoundry config parsing logic
By replacing user-provided services with manifest environment variables
we avoid the need to set the application environment variables from the
service data.

Most of the variable names already match the service JSON keys, but we
need to rename the ones that don't (eg MMG and Firetext `api_key`) this
is done in a separate credentials PR.
2018-01-09 10:45:03 +00:00
venusbb
ab66f5c0ac Change MMG username to look at env variable 2017-12-15 12:19:58 +00:00
Katie Smith
a8d3b0952f Add MMG_INBOUND_SMS_AUTH config variable and auth check
Checks authentication header value on inbound SMS requests from
MMG  against a list of allowed API keys set in the application
config.

At the moment, we're only logging the attempts without aborting the
requests. Once this is rolled out to production and we've checked
the logs we'll switch on the aborts and add the tests for 401 and 403
responses.

This work has already been done for Firetext in a previous PR:
https://github.com/alphagov/notifications-api/pull/1409
2017-12-14 13:37:50 +00:00
Ken Tsang
ebfd78f3cf Add template preview host url and key to cf config 2017-12-12 14:53:38 +00:00
Alexey Bezhan
5e53d781e0 Add FIRETEXT_INBOUND_SMS_AUTH config variable and auth check
Checks authentication header value on inbound SMS requests from
Firetext against a list of allowed API keys set in the application
config.

At the moment, we're only logging the attempts without aborting the
requests. Once this is rolled out to production and we've checked
the logs we'll switch on the aborts and add the tests for 401 and 403
responses.
2017-11-22 09:54:42 +00:00
venusbb
f4d005c7fb initial logging for route protection 2017-11-03 14:43:56 +00:00
Leo Hemsted
bd2682b521 add new performance-platform section to cf config
it's a new cf-service we've got to create, that contains endpoints
and the bearer tokens for them.
2017-08-23 18:14:35 +01:00
Leo Hemsted
e7b13e727a don't capture logs directly from stdout
previously in run_app_paas.sh, we captured stdout from the app and
piped that into the log file. However, this came up with a bunch of
problems, mainly:

* exceptions with stack traces often weren't formatted properly,
  and kibana could not parse them
* celery logs were duplicated - we'd collect both the json logs and
  the human readable stdout logs.

instead, with the updated utils library, we can use that to log json
straight to the appropriate directory directly.
2017-08-09 15:29:39 +01:00
Leo Hemsted
7f883f1355 don't store non-strings to os.environ
in tests, we were replacing os.environ with a basic dict so that
we didn't overwrite the contents of the real environment during tests.
However, os.environ doesn't accept non-str values, so this commit
changes the fixture so that it asserts all values set are strings.
We needed to change how we store ip whitelist stuff in the env because
of this.
2017-07-11 15:41:44 +01:00
venusbb
5089a4d53b retrieve sms ip whitelist from credentials on paas 2017-07-10 17:03:43 +01:00
Leo Hemsted
1c4da5367f Can't set environs to nonetype 2017-03-31 17:10:43 +01:00
Ken Tsang
d5e8cb3354 Updated cf conf unit tests 2017-03-31 16:50:30 +01:00
Ken Tsang
316d8fdb0d Updated config to cloudfoundry_config 2017-03-31 16:37:04 +01:00
bandesz
e8bf03c7e1 Get Redis config from PaaS 2017-03-03 11:35:51 +00:00
bandesz
fd66fbd719 Run API on Paas 2017-01-13 10:24:13 +00:00