@harryhope/fdeploy 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +26 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -6,6 +6,31 @@ const path = require('path')
6
6
  const yargs = require('yargs/yargs')
7
7
  const { hideBin } = require('yargs/helpers')
8
8
 
9
+ const maskValue = (value) => {
10
+ if (!value || value.length <= 8) {
11
+ return value
12
+ }
13
+ const first4 = value.slice(0, 4)
14
+ const last4 = value.slice(-4)
15
+ const masked = 'x'.repeat(value.length - 8)
16
+ return `${first4}${masked}${last4}`
17
+ }
18
+
19
+ const maskEnvironmentVariables = (data) => {
20
+ if (!data?.Environment?.Variables) {
21
+ return data
22
+ }
23
+
24
+ const maskedData = JSON.parse(JSON.stringify(data))
25
+ const variables = maskedData.Environment.Variables
26
+
27
+ for (const key in variables) {
28
+ variables[key] = maskValue(variables[key])
29
+ }
30
+
31
+ return maskedData
32
+ }
33
+
9
34
  const deploy = async (funcName, dir, region, envPath) => {
10
35
  const folder = path.resolve(dir || process.cwd())
11
36
  const envFilePath = envPath
@@ -48,7 +73,7 @@ const deploy = async (funcName, dir, region, envPath) => {
48
73
  console.log()
49
74
  console.log(chalk.bgRed.bold(`Failed to deploy ${funcName}`))
50
75
  } else {
51
- console.log(data)
76
+ console.log(maskEnvironmentVariables(data))
52
77
  console.log()
53
78
  console.log(chalk.bgGreen.bold(`${funcName} deployed successfully`))
54
79
  console.log()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harryhope/fdeploy",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "A CLI for deploying AWS Lambda functions",
5
5
  "main": "index.js",
6
6
  "scripts": {