Skip to content

Commit

Permalink
Added user-agent header to Doppler provider (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-blunden authored May 2, 2022
1 parent 0d59c21 commit a22c14c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.1.0 (March 18, 2022)
## 0.0.2 (March 24, 2022)

- Initial release

## 0.0.3 (April 27, 2022)

- Added `user-agent` header to Doppler provider
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# GitOps Secrets for Node.js
# GitOps Secrets

Hello, GitOps Secrets! Goodbye environment variable storage limits.

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gitops-secrets",
"version": "0.0.2",
"version": "0.0.3",
"author": "Ryan Blunden <[email protected]>",
"description": "Securely bundle encrypted secrets into your deployments and safely decrypt at runtime.",
"repository": {
Expand Down Expand Up @@ -44,7 +44,8 @@
"test": "jest",
"lint": "eslint ./src ./tests",
"prettier": "prettier --write .",
"prettier-check": "prettier --check ."
"prettier-check": "prettier --check .",
"prepublishOnly": "sed -i \"s/development/$npm_package_version/\" src/meta.js"
},
"dependencies": {},
"devDependencies": {
Expand Down
3 changes: 3 additions & 0 deletions src/meta.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const VERSION = "development";

module.exports = { VERSION: VERSION };
4 changes: 3 additions & 1 deletion src/providers/doppler.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const https = require("https");

const { VERSION } = require("../meta");
/**
* Fetch secrets from Doppler the API.
* Requires the `DOPPLER_TOKEN` environment variable to be set. See https://docs.doppler.com/docs/enclave-service-tokens
Expand All @@ -13,12 +13,14 @@ async function fetch() {
return new Promise(function (resolve, reject) {
const encodedAuthData = Buffer.from(`${process.env.DOPPLER_TOKEN}:`).toString("base64");
const authHeader = `Basic ${encodedAuthData}`;
const userAgent = `gitops-secrets-nodejs/${VERSION}`;
https
.get(
"https://api.doppler.com/v3/configs/config/secrets/download?format=json",
{
headers: {
Authorization: authHeader,
"user-agent": userAgent,
},
},
(res) => {
Expand Down

0 comments on commit a22c14c

Please sign in to comment.