Created
April 9, 2019 17:58
-
-
Save eyarz/595b74b9e831b5a79dd9c020a15dd3e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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