Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Commit

Permalink
fix: reverts assumeRole to use pod role instead of web identity (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
Flydiverny authored Jul 29, 2020
1 parent d722e1a commit fa747dc
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions config/aws-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
const AWS = require('aws-sdk')
const clonedeep = require('lodash.clonedeep')
const merge = require('lodash.merge')
const fs = require('fs')

const localstack = process.env.LOCALSTACK || 0
const webIdentity = process.env.AWS_WEB_IDENTITY_TOKEN_FILE || 0

let secretsManagerConfig = {}
let systemManagerConfig = {}
Expand All @@ -31,10 +29,6 @@ if (localstack) {
}
}

function loadServiceToken () {
return fs.readFileSync(webIdentity, 'utf8')
}

module.exports = {
secretsManagerFactory: (opts = {}) => {
if (localstack) {
Expand All @@ -50,16 +44,6 @@ module.exports = {
},
assumeRole: (assumeRoleOpts) => {
const sts = new AWS.STS(stsConfig)
if (webIdentity) {
return new Promise((resolve, reject) => {
sts.assumeRoleWithWebIdentity(merge(assumeRoleOpts, { WebIdentityToken: loadServiceToken() }), (err, res) => {
if (err) {
return reject(err)
}
resolve(res)
})
})
}

return new Promise((resolve, reject) => {
sts.assumeRole(assumeRoleOpts, (err, res) => {
Expand Down

0 comments on commit fa747dc

Please sign in to comment.