-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
115 additions
and
4 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#! /usr/bin/env node | ||
|
||
import { program } from "commander"; | ||
|
||
import Action from "../src/action/Action.js"; | ||
|
||
const sync = async (secret, options) => { | ||
console.log(secret); | ||
console.log(options); | ||
|
||
const action = new Action( | ||
options.awsAccessKey, | ||
options.awsSecretKey, | ||
options.awsRegion, | ||
secret, | ||
options.file, | ||
options.exclude || "^_", | ||
options.showValues, | ||
options.createSecret, | ||
); | ||
|
||
const changeSet = await action.run(); | ||
|
||
for (const desc of changeSet.changeDesc()) { | ||
console.log(desc); | ||
} | ||
|
||
if (!dryRun) { | ||
await changeSet.apply(); | ||
console.log("Secrets has been synced!!"); | ||
} | ||
}; | ||
|
||
program | ||
.command("sync") | ||
.argument("<secret-name>", "Secret name") | ||
.option("--file <string>", "Path to json file to be synced", "") | ||
.option("--create-secret", "Create secret if not exists") | ||
.option("--show-values", "Show secret values when viewing change set") | ||
.option("--dry-run", "Preview changes without modifying the secret") | ||
.option("--aws-access-key <string>", "AWS Access key id", "") | ||
.option("--aws-secret-key <string>", "AWS Secret access key", "") | ||
.option("--aws-region <string>", "AWS region", "") | ||
.option( | ||
"--exclude <string>", | ||
"Regular expression to match keys to be excluded from sync", | ||
) | ||
.description("Sync secrets file") | ||
.action(sync); | ||
|
||
program.parse(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "cli", | ||
"version": "1.0.0", | ||
"description": "", | ||
"type": "module", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"chalk": "^5.3.0", | ||
"commander": "^12.0.0" | ||
} | ||
} |
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