Skip to content

Commit

Permalink
Merge pull request #117 from Financial-Times/ci-2184-doppler-format
Browse files Browse the repository at this point in the history
feat: CI-2184 set doppler autorotated keynames to ones accepted by si…
  • Loading branch information
debugwand authored Apr 9, 2024
2 parents b7fe383 + 855f24c commit 7927a01
Show file tree
Hide file tree
Showing 6 changed files with 4,502 additions and 4,657 deletions.
91 changes: 44 additions & 47 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# CONFIG GENERATED BY DOTCOM-TOOL-KIT, DO NOT EDIT BY HAND
version: 2.1
orbs:
tool-kit: financial-times/dotcom-tool-kit@2
node: circleci/[email protected]
tool-kit: financial-times/dotcom-tool-kit@5
executors:
node:
docker:
- image: cimg/node:16.14-browsers
jobs:
checkout:
docker:
Expand All @@ -11,32 +14,7 @@ jobs:
- checkout
- tool-kit/persist-workspace:
path: .
testci-coverage:
executor:
name: node/default
tag: <<parameters.node-version>>
parameters:
node-version:
default: "16.14"
type: string
steps:
- tool-kit/attach-workspace
- run:
name: Run tests coverage
command: "npm run coverage"
environment:
JEST_JUNIT_OUTPUT: test-results/jest/results.xml # TODO change depending on which test plugin is running? or actually, move this into the plugin? or do it as tool kit config. hmm
MOCHA_FILE: test-results/mocha/results.xml
- run:
name: output coverage report
command: "cat ./coverage/lcov.info | ./node_modules/.bin/coveralls"
- store_test_results:
path: test-results
- store_artifacts:
path: test-results
destination: test-results
workflows:
version: 2
tool-kit:
when:
not:
Expand All @@ -53,47 +31,51 @@ workflows:
filters:
branches:
only: /(^renovate-.*|^nori/.*)/
tags:
only: /^v\d+\.\d+\.\d+(-.+)?/
- tool-kit/setup:
name: tool-kit/setup-<< matrix.executor >>
requires:
- checkout
- waiting-for-approval
matrix:
parameters:
executor:
- node
filters:
tags:
only: /^v\d+\.\d+\.\d+(-.+)?/
- tool-kit/build:
node-version: 16.14-browsers
name: tool-kit/build-<< matrix.executor >>
requires:
- tool-kit/setup
- tool-kit/setup-<< matrix.executor >>
matrix:
parameters:
executor:
- node
filters:
tags:
only: /^v\d+\.\d+\.\d+(-.+)?/
- tool-kit/test:
node-version: 16.14-browsers
name: tool-kit/test-<< matrix.executor >>
requires:
- tool-kit/build
- tool-kit/build-<< matrix.executor >>
matrix:
parameters:
executor:
- node
filters:
tags:
only: /^v\d+\.\d+\.\d+(-.+)?/
- testci-coverage:
node-version: 16.14-browsers
- tool-kit/publish-tag:
requires:
- tool-kit/build
- tool-kit/test-node
name: tool-kit/publish-tag-node
executor: node
filters:
tags:
only: /^v\d+\.\d+\.\d+(-.+)?/
- tool-kit/publish:
node-version: 16.14-browsers
context: npm-publish-token
requires:
- tool-kit/test
- testci-coverage
filters:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+(-.+)?/
context: npm-publish-token
nightly:
when:
and:
Expand All @@ -106,11 +88,26 @@ workflows:
jobs:
- checkout
- tool-kit/setup:
name: tool-kit/setup-<< matrix.executor >>
requires:
- checkout
matrix:
parameters:
executor:
- node
- tool-kit/build:
name: tool-kit/build-<< matrix.executor >>
requires:
- tool-kit/setup
- tool-kit/setup-<< matrix.executor >>
matrix:
parameters:
executor:
- node
- tool-kit/test:
name: tool-kit/test-<< matrix.executor >>
requires:
- tool-kit/build
- tool-kit/build-<< matrix.executor >>
matrix:
parameters:
executor:
- node
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ export ES_AWS_ACCESS_KEY=123
export ES_AWS_SECRET_ACCESS_KEY=456
```

### Doppler compatibility

Set your secret name as `ES_AWS_ACCESS_KEY_ID` for the AWS ACCESS KEY, and this library will write its value to `ES_AWS_ACCESS_KEY` so that `signed-aws-es-fetch` accepts it

## Usage

All methods return a promise. If a request errors then it will be rejected with an appropriate HTTP error. Each method accepts an options object that will be preserved verbatim and sent with the request, either stringified as part of the URL or as the `POST` body.
Expand Down
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// doppler auto secret rotation requires a suffix of _ACCESS_KEY_ID, but signed-es-aws-fetch module does not have that in its list of accepted key names
if (process.env.ES_AWS_ACCESS_KEY_ID) {
process.env.ES_AWS_ACCESS_KEY = process.env.ES_AWS_ACCESS_KEY_ID;
}

module.exports = {
search: require('./lib/search'),
count: require('./lib/count'),
Expand Down
3 changes: 2 additions & 1 deletion lib/helpers/get-endpoint.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const logger = require('@dotcom-reliability-kit/logger');

const endpoints = {
development: 'https://search-next-elasticsearch-v7-dev-znli3en2mvhur6j35qsr4673fq.eu-west-1.es.amazonaws.com',
development:
'https://search-next-elasticsearch-v7-dev-znli3en2mvhur6j35qsr4673fq.eu-west-1.es.amazonaws.com',
production: 'https://next-elasticsearch-v7.gslb.ft.com'
};

Expand Down
Loading

0 comments on commit 7927a01

Please sign in to comment.