Skip to content

Instantly share code, notes, and snippets.

@eyarz
Created April 9, 2019 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eyarz/595b74b9e831b5a79dd9c020a15dd3e1 to your computer and use it in GitHub Desktop.
Save eyarz/595b74b9e831b5a79dd9c020a15dd3e1 to your computer and use it in GitHub Desktop.
const fs = require('fs')
const path = require('path')
try {
fs.unlinkSync(path.join(__dirname, 'local.json'))
} catch (err) {}
const AWS = require('aws-sdk')
AWS.config.update({ region: 'us-east-1' })
const ssm = new AWS.SSM()
var serviceName = require('../package.json').name
async function getConfig() {
var params = {
Name: serviceName,
WithDecryption: true
}
let res = await ssm.getParameter(params).promise()
let settings = res.Parameter.Value
writeLocalConfig(settings)
}
function writeLocalConfig(settings) {
fs.writeFileSync(path.join(__dirname, 'local.json'), settings)
}
getConfig()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment