@goldstack/infra-aws
Advanced tools
Comparing version 0.1.26 to 0.1.27
@@ -1,4 +0,6 @@ | ||
import { AWSConfiguration, AWSUser, AWSRegion, AWSLocalUserConfig, AWSAPIKeyUser, AWSEnvironmentVariableUserConfig } from './generated/awsConfigSchema'; | ||
export type { AWSConfiguration, AWSUser, AWSRegion, AWSLocalUserConfig, AWSAPIKeyUser, AWSEnvironmentVariableUserConfig, }; | ||
export { AWSDeployment, AWSDeploymentRegion, AWSUserName, } from './infraAwsDeployment'; | ||
import { AWSConfiguration, AWSUser, AWSRegion, AWSLocalUserConfig, AWSAPIKeyUserConfig, AWSEnvironmentVariableUserConfig } from './types/awsAccount'; | ||
export type { AWSConfiguration, AWSUser, AWSRegion, AWSLocalUserConfig, AWSAPIKeyUserConfig as AWSAPIKeyUser, AWSEnvironmentVariableUserConfig, }; | ||
import { AWSDeployment } from './types/awsDeployment'; | ||
export { AWSDeployment, AWSDeploymentRegion, AWSDeploymentConfiguration, AWSUserName, } from './types/awsDeployment'; | ||
export declare const readDeploymentFromPackageConfig: (deploymentName: string, path?: string | undefined) => AWSDeployment; | ||
export declare const readConfig: (path?: string | undefined) => AWSConfiguration; | ||
@@ -9,3 +11,3 @@ export declare const createDefaultConfig: () => AWSConfiguration; | ||
**/ | ||
export declare const getAWSUser: (userName: string) => AWSAPIKeyUser; | ||
export declare const getAWSUser: (userName: string) => AWSAPIKeyUserConfig; | ||
//# sourceMappingURL=infraAws.d.ts.map |
@@ -6,8 +6,21 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getAWSUser = exports.createDefaultConfig = exports.readConfig = void 0; | ||
exports.getAWSUser = exports.createDefaultConfig = exports.readConfig = exports.readDeploymentFromPackageConfig = void 0; | ||
var fs_1 = __importDefault(require("fs")); | ||
var utils_config_1 = require("@goldstack/utils-config"); | ||
var utils_package_1 = require("@goldstack/utils-package"); | ||
var utils_sh_1 = require("@goldstack/utils-sh"); | ||
var utils_log_1 = require("@goldstack/utils-log"); | ||
var awsConfigSchema_json_1 = __importDefault(require("./schemas/awsConfigSchema.json")); | ||
var accountConfigSchema_json_1 = __importDefault(require("./schemas/accountConfigSchema.json")); | ||
var deploymentConfigSchema_json_1 = __importDefault(require("./schemas/deploymentConfigSchema.json")); | ||
exports.readDeploymentFromPackageConfig = function (deploymentName, path) { | ||
var packageConfig = utils_package_1.readPackageConfig(path); | ||
var config = utils_config_1.validateConfig(packageConfig.configuration.infrastructure, deploymentConfigSchema_json_1.default, { | ||
errorMessage: 'Cannot load AWS deployment from configration', | ||
}); | ||
var deployment = config.deployments.find(function (d) { return d.name === deploymentName; }); | ||
if (!deployment) { | ||
throw new Error('Cannot find deployment with name: ' + deploymentName); | ||
} | ||
return deployment; | ||
}; | ||
exports.readConfig = function (path) { | ||
@@ -21,3 +34,3 @@ if (!path) { | ||
} | ||
return utils_config_1.parseConfig(utils_sh_1.read(path), awsConfigSchema_json_1.default, { | ||
return utils_config_1.parseConfig(utils_sh_1.read(path), accountConfigSchema_json_1.default, { | ||
errorMessage: 'Cannot load AWS configuration.', | ||
@@ -48,5 +61,2 @@ }); | ||
if (!awsAccessKeyId) { | ||
console.log(awsAccessKeyId); | ||
console.log(JSON.stringify(userConfig, null, 2)); | ||
console.log(process.env); | ||
throw new Error("Environment variable expected but not found: " + userConfig.awsAccessKeyIdVariableName); | ||
@@ -73,2 +83,18 @@ } | ||
}; | ||
var getDeployment = function (args) { | ||
if (args.length < 1) { | ||
utils_log_1.fatal('Please specify the name of the deployment.'); | ||
} | ||
var name = args[0]; | ||
var packageConfig = utils_package_1.readPackageConfig(); | ||
var config = utils_config_1.validateConfig(packageConfig.configuration, accountConfigSchema_json_1.default, { | ||
errorMessage: 'Cannot parse configuration for Terraform deployment.', | ||
}); | ||
var deployment = config.deployments.find(function (deployment) { return deployment.name === name; }); | ||
if (!deployment) { | ||
utils_log_1.fatal("Cannot find configuration for deployment '" + name + "''"); | ||
throw new Error('Cannot parse configuration.'); | ||
} | ||
return deployment; | ||
}; | ||
//# sourceMappingURL=infraAws.js.map |
{ | ||
"name": "@goldstack/infra-aws", | ||
"version": "0.1.26", | ||
"version": "0.1.27", | ||
"description": "Utilities to work with AWS infrastructrue via the cli.", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"coverage": "jest --collect-coverage --passWithNoTests --config=./jest.config.js", | ||
"generate:ts": "rm -rf ./src/generated && json2ts -i src/schemas/ -o src/generated --style.singleQuote && renamer --find .d.ts --replace .ts \"./src/generated/**\"", | ||
"generate:schema": "ts-json-schema-generator --tsconfig tsconfig.generate.json --path './src/types/**/*' --type 'AWSConfiguration' -o src/schemas/accountConfigSchema.json && ts-json-schema-generator --tsconfig tsconfig.generate.json --path './src/types/**/*' --type 'AWSDeploymentConfiguration' -o src/schemas/deploymentConfigSchema.json", | ||
"prepublishOnly": "yarn run build", | ||
@@ -24,6 +24,7 @@ "publish": "utils-git changed --exec \"yarn npm publish $@\"", | ||
"dependencies": { | ||
"@goldstack/infra": "0.1.25", | ||
"@goldstack/utils-config": "0.1.25", | ||
"@goldstack/utils-log": "0.1.31", | ||
"@goldstack/utils-sh": "0.1.25", | ||
"@goldstack/infra": "0.1.26", | ||
"@goldstack/utils-config": "0.1.26", | ||
"@goldstack/utils-log": "0.1.32", | ||
"@goldstack/utils-package": "0.1.25", | ||
"@goldstack/utils-sh": "0.1.26", | ||
"handlebars": "^4.7.6" | ||
@@ -36,7 +37,7 @@ }, | ||
"jest": "^26.0.1", | ||
"json-schema-to-typescript": "^9.1.1", | ||
"renamer": "^0.7.0", | ||
"ts-jest": "^26.1.0", | ||
"ts-json-schema-generator": "^0.70.2", | ||
"typescript": "^3.9.5" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
26859
16
536
5
6
1
+ Added@goldstack/infra@0.1.26(transitive)
+ Added@goldstack/utils-config@0.1.26(transitive)
+ Added@goldstack/utils-log@0.1.32(transitive)
+ Added@goldstack/utils-package@0.1.25(transitive)
+ Added@goldstack/utils-sh@0.1.26(transitive)
- Removed@goldstack/utils-config@0.1.25(transitive)
- Removed@goldstack/utils-log@0.1.31(transitive)
- Removed@goldstack/utils-sh@0.1.25(transitive)
Updated@goldstack/infra@0.1.26
Updated@goldstack/utils-log@0.1.32
Updated@goldstack/utils-sh@0.1.26