@fishawack/lab-env 5.1.0 → 5.2.0-beta.1

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 (35) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/_Test/key.js +7 -2
  3. package/_Test/provision.js +9 -19
  4. package/_Test/s3.js +10 -6
  5. package/adonis/0/nginx/package.json +1 -1
  6. package/commands/content.js +36 -25
  7. package/commands/create/cmds/deprovision.js +10 -2
  8. package/commands/create/cmds/provision.js +13 -2
  9. package/commands/create/libs/prompts.js +9 -0
  10. package/commands/create/libs/vars.js +67 -35
  11. package/commands/create/services/aws/cloudfront.js +17 -20
  12. package/commands/create/services/aws/ec2.js +2 -3
  13. package/commands/create/services/aws/elasticbeanstalk.js +11 -14
  14. package/commands/create/services/aws/iam.js +123 -65
  15. package/commands/create/services/aws/index.js +35 -35
  16. package/commands/create/services/aws/misc.js +6 -7
  17. package/commands/create/services/aws/s3.js +16 -16
  18. package/commands/create/templates/elasticbeanstalk/.ebextensions/misc/asg-self-healing.config +6 -0
  19. package/commands/create/templates/elasticbeanstalk/.ebextensions/misc/health-ignore-4xx.config +4 -0
  20. package/core/0/package.json +1 -1
  21. package/craftcms/3/apache/package.json +1 -1
  22. package/craftcms/3/php/package.json +1 -1
  23. package/drupal/9/apache/package.json +1 -1
  24. package/drupal/9/php/package.json +1 -1
  25. package/globals.js +15 -0
  26. package/laravel/8/nginx/package.json +1 -1
  27. package/laravel/8/php/package.json +1 -1
  28. package/package.json +1 -1
  29. package/php/8.2/package.json +1 -1
  30. package/python/0/Dockerfile +8 -0
  31. package/python/0/docker-compose.yml +4 -1
  32. package/python/0/package.json +11 -0
  33. package/wordpress/0/package.json +1 -1
  34. package/wordpress/1/apache/package.json +1 -1
  35. package/wordpress/1/php/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  ## Changelog
2
2
 
3
+ ### 5.2.0-beta.1 (2026-01-14)
4
+
5
+ #### Features
6
+
7
+ * added ignore 4xx and self healing configs to default high avail provision ([d8d2748](https://bitbucket.org/fishawackdigital/lab-env/commits/d8d27484973779e7954a23618f1af98fcb698a7b))
8
+ * can now set region for prov and deprov commands ([2a2d06e](https://bitbucket.org/fishawackdigital/lab-env/commits/2a2d06e8a3bb1fff4b25cea41f1027aa0d6949f7))
9
+ * database now only added if asked for via prompt ([dc890bb](https://bitbucket.org/fishawackdigital/lab-env/commits/dc890bb52bf44cc529a0ec47e621fa0b0eea2d51))
10
+ * flatten environment settings so nested objects can be set together that share conditions ([5bbcc30](https://bitbucket.org/fishawackdigital/lab-env/commits/5bbcc301e93789c6e0bad05e321ff66f80f973cb))
11
+ * objects in environemnt settings now takes a method to allow customization ([d1a2456](https://bitbucket.org/fishawackdigital/lab-env/commits/d1a24567c45ef98840766555debde9932b90ad6c))
12
+ * python now has a self authored based image allowing overriding ([3a3827c](https://bitbucket.org/fishawackdigital/lab-env/commits/3a3827c6b26a14fb204888f86c74494141bf6880))
13
+ * region is now a list rather than free text ([d1eceea](https://bitbucket.org/fishawackdigital/lab-env/commits/d1eceeaad271686b18cb8d8ef786c2b9c9aac070))
14
+ * setup custom managed elasticbeanstalk profile on new prov commands ([75559af](https://bitbucket.org/fishawackdigital/lab-env/commits/75559afbace897eebf380fe66df6d6ab22758fbb))
15
+ * switch subnets and vpc when switching between eu and us python services ([817d60a](https://bitbucket.org/fishawackdigital/lab-env/commits/817d60ade606716184074342c6e1d19a54115140))
16
+ * utilize python self authored image and allow overriding ([a63ae30](https://bitbucket.org/fishawackdigital/lab-env/commits/a63ae30213a7101d9030efe7b2240e8dc1b73053))
17
+
18
+ #### Bug Fixes
19
+
20
+ * added missing list tags permission ([bcff194](https://bitbucket.org/fishawackdigital/lab-env/commits/bcff19487d1b26ec2529309925cfb625733e4ed2))
21
+ * deprov no longer prompts for region ([2b3a627](https://bitbucket.org/fishawackdigital/lab-env/commits/2b3a62749463f6280ab52e1e6ed8d24e8d5a8f4a))
22
+ * handle errors on content command ([25e32bb](https://bitbucket.org/fishawackdigital/lab-env/commits/25e32bb78ded523ef25eee2b467dc4be7c05ca5f))
23
+ * only prompt for region on fullstack as cloudfront only supports us-east-1 ([53d8ef7](https://bitbucket.org/fishawackdigital/lab-env/commits/53d8ef7eb85d175ee5e684f34509f83f74a24f48))
24
+ * remove client from method params ([29b8423](https://bitbucket.org/fishawackdigital/lab-env/commits/29b84238c32742044dba867a90616506918a4d3e))
25
+ * use same role for service and managed updates ([4a69f4d](https://bitbucket.org/fishawackdigital/lab-env/commits/4a69f4d20c2231f8cffb95c4790f0e557ba59d57))
26
+
27
+ #### Build Updates
28
+
29
+ * bumped fishawack/lab-env-python-0 to 1.0.0 ([21d7da1](https://bitbucket.org/fishawackdigital/lab-env/commits/21d7da1bbdcf932fe74351882282577710bfb81d))
30
+ * updated auto bumped commands to pass linting ([437d2e8](https://bitbucket.org/fishawackdigital/lab-env/commits/437d2e8c9e9d183f955c17a8edb7186dc61f2e0f))
31
+
3
32
  ### 5.1.0 (2025-12-23)
4
33
 
5
34
  #### Features
package/_Test/key.js CHANGED
@@ -2,12 +2,17 @@
2
2
 
3
3
  const expect = require("chai").expect;
4
4
  const aws = require("../commands/create/services/aws/index.js");
5
+ const {
6
+ setAWSClientDefaults,
7
+ } = require("../commands/create/services/aws/misc.js");
5
8
 
6
9
  describe("key", async () => {
7
10
  let account = "fishawack";
8
11
 
9
12
  before(async () => {
10
- let res = await aws.iam.createFWIAMUser("fw-test-user", account);
13
+ setAWSClientDefaults(account);
14
+
15
+ let res = await aws.iam.createFWIAMUser("fw-test-user");
11
16
 
12
17
  // Wait for key as AWS doesn't provide a way to wait for it to becom eactive
13
18
  await new Promise((resolve) => setTimeout(() => resolve(), 10000));
@@ -32,6 +37,6 @@ describe("key", async () => {
32
37
  delete process.env.AWS_ACCESS_KEY_ID;
33
38
  delete process.env.AWS_SECRET_ACCESS_KEY;
34
39
 
35
- await aws.iam.removeIAMUser("fw-test-user", account);
40
+ await aws.iam.removeIAMUser("fw-test-user");
36
41
  });
37
42
  });
@@ -3,6 +3,9 @@
3
3
  const expect = require("chai").expect;
4
4
  const execSync = require("child_process").execSync;
5
5
  const aws = require("../commands/create/services/aws/index.js");
6
+ const {
7
+ setAWSClientDefaults,
8
+ } = require("../commands/create/services/aws/misc.js");
6
9
  var fetch;
7
10
 
8
11
  describe("provision", () => {
@@ -14,20 +17,14 @@ describe("provision", () => {
14
17
 
15
18
  describe("static", () => {
16
19
  before(async () => {
20
+ setAWSClientDefaults(account);
21
+
17
22
  fetch = (await import("node-fetch")).default;
18
23
 
19
- config = await aws.static(
20
- name,
21
- account,
22
- undefined,
23
- undefined,
24
- repo,
25
- branch,
26
- );
24
+ config = await aws.static(name, undefined, undefined, repo, branch);
27
25
 
28
26
  await aws.s3.addFileToS3Bucket(
29
27
  name,
30
- account,
31
28
  "index.html",
32
29
  new TextEncoder().encode("test"),
33
30
  );
@@ -38,15 +35,9 @@ describe("provision", () => {
38
35
  });
39
36
 
40
37
  after(async () => {
41
- await aws.s3.removeFileToS3Bucket(name, account, "index.html");
38
+ await aws.s3.removeFileToS3Bucket(name, "index.html");
42
39
 
43
- await aws.staticTerminate(
44
- name,
45
- account,
46
- repo,
47
- branch,
48
- config.cloudfront,
49
- );
40
+ await aws.staticTerminate(name, repo, branch, config.cloudfront);
50
41
  });
51
42
  });
52
43
 
@@ -58,7 +49,6 @@ describe("provision", () => {
58
49
 
59
50
  config = await aws.fullstack(
60
51
  repo,
61
- account,
62
52
  [],
63
53
  [],
64
54
  repo,
@@ -74,7 +64,7 @@ describe("provision", () => {
74
64
  });
75
65
 
76
66
  after(async () => {
77
- await aws.fullstackTerminate(repo, account, repo, branch);
67
+ await aws.fullstackTerminate(repo, repo, branch);
78
68
 
79
69
  execSync(`rm -rf .elasticbeanstalk`, {
80
70
  encoding: "utf8",
package/_Test/s3.js CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  const expect = require("chai").expect;
4
4
  const s3 = require("../commands/create/services/aws/s3.js");
5
+ const {
6
+ setAWSClientDefaults,
7
+ } = require("../commands/create/services/aws/misc.js");
5
8
 
6
9
  describe("s3", () => {
7
10
  let repo = "lab-env-test-suite";
@@ -9,11 +12,12 @@ describe("s3", () => {
9
12
 
10
13
  describe("terminate", () => {
11
14
  before(async () => {
12
- await s3.createS3Bucket(repo, account);
15
+ setAWSClientDefaults(account);
16
+
17
+ await s3.createS3Bucket(repo);
13
18
 
14
19
  await s3.addFileToS3Bucket(
15
20
  repo,
16
- account,
17
21
  "index.html",
18
22
  new TextEncoder().encode("test"),
19
23
  );
@@ -22,10 +26,10 @@ describe("s3", () => {
22
26
  it("Should remove all files from bucket during terminate process", async () => {
23
27
  let err;
24
28
 
25
- await s3.emptyS3Bucket(repo, account);
29
+ await s3.emptyS3Bucket(repo);
26
30
 
27
31
  try {
28
- await s3.removeS3Bucket(repo, account);
32
+ await s3.removeS3Bucket(repo);
29
33
  } catch (e) {
30
34
  err = e;
31
35
  }
@@ -35,9 +39,9 @@ describe("s3", () => {
35
39
 
36
40
  after(async () => {
37
41
  try {
38
- await s3.removeFileToS3Bucket(repo, account, "index.html");
42
+ await s3.removeFileToS3Bucket(repo, "index.html");
39
43
 
40
- await s3.removeS3Bucket(repo, account);
44
+ await s3.removeS3Bucket(repo);
41
45
  } catch {
42
46
  /* empty */
43
47
  }
@@ -4,7 +4,7 @@
4
4
  "description": "lab-env docker config for the nginx module",
5
5
  "scripts": {
6
6
  "preversion": "docker login",
7
- "postversion": "docker buildx build --target development --platform linux/amd64,linux/arm64 -t fishawack/lab-env-adonis-0-nginx:$npm_package_version -t fishawack/lab-env-adonis-0-nginx:latest --push . && git add . && git commit -m \"build: Bumped fishawack/lab-env-adonis-0-nginx to $npm_package_version\""
7
+ "postversion": "docker buildx build --target development --platform linux/amd64,linux/arm64 -t fishawack/lab-env-adonis-0-nginx:$npm_package_version -t fishawack/lab-env-adonis-0-nginx:latest --push . && git add . && git commit -m \"build: bumped fishawack/lab-env-adonis-0-nginx to $npm_package_version\""
8
8
  },
9
9
  "author": "Mike Mellor",
10
10
  "license": "ISC"
@@ -37,36 +37,47 @@ module.exports = [
37
37
  } else {
38
38
  _.command("core", `npm run content`);
39
39
 
40
- if (process.env.HUB_URL) {
41
- console.log(`Syncing branch configurations from Hub...`);
42
- // TODO: Fetch specific values and map to core config vlaues
43
- // TODO: Add migration step of test ui to docs
44
- const repository = await findRepository(_.remote);
45
- const configurations = await getConfigurations(repository?.id);
40
+ try {
41
+ if (process.env.HUB_URL) {
42
+ console.log(`Syncing branch configurations from Hub...`);
43
+ // TODO: Fetch specific values and map to core config vlaues
44
+ // TODO: Add migration step of test ui to docs
45
+ const repository = await findRepository(_.remote);
46
+ const configurations = await getConfigurations(
47
+ repository?.id,
48
+ );
46
49
 
47
- // Remove existing hub configuration files
48
- glob.sync("hub.*.*.json").forEach((file) =>
49
- fs.removeSync(file),
50
- );
50
+ // Remove existing hub configuration files
51
+ glob.sync("hub.*.*.json").forEach((file) =>
52
+ fs.removeSync(file),
53
+ );
51
54
 
52
- configurations?.forEach(({ config, id, branch }) => {
53
- const filePath = `hub.${branch}.${id}.json`;
55
+ configurations?.forEach(({ config, id, branch }) => {
56
+ const filePath = `hub.${branch}.${id}.json`;
54
57
 
55
- fs.writeFileSync(
56
- filePath,
57
- JSON.stringify(
58
- {
59
- attributes: {
60
- targets: {
61
- [branch]: config,
58
+ fs.writeFileSync(
59
+ filePath,
60
+ JSON.stringify(
61
+ {
62
+ attributes: {
63
+ targets: {
64
+ [branch]: config,
65
+ },
62
66
  },
63
67
  },
64
- },
65
- null,
66
- 4,
67
- ),
68
- );
69
- });
68
+ null,
69
+ 4,
70
+ ),
71
+ );
72
+ });
73
+ }
74
+ } catch (error) {
75
+ console.log(
76
+ utilities.colorize(
77
+ `\nUnable to sync configurations from Hub: ${error.message}\n`,
78
+ "error",
79
+ ),
80
+ );
70
81
  }
71
82
  }
72
83
  },
@@ -1,8 +1,9 @@
1
1
  const _ = require("../../../globals.js");
2
2
  const inquirer = require("inquirer");
3
3
  const aws = require("../services/aws/index.js");
4
+ const { setAWSClientDefaults } = require("../services/aws/misc.js");
4
5
  const utilities = require("../libs/utilities");
5
- const { stack, client } = require("../libs/prompts.js");
6
+ const { stack, client, region } = require("../libs/prompts.js");
6
7
 
7
8
  module.exports = [
8
9
  ["deprovision", "deprov"],
@@ -47,6 +48,11 @@ module.exports = [
47
48
  },
48
49
  ])),
49
50
  };
51
+ } else {
52
+ answers = {
53
+ ...answers,
54
+ ...(await inquirer.prompt([region])),
55
+ };
50
56
  }
51
57
 
52
58
  const slug = aws.slug(
@@ -69,9 +75,11 @@ module.exports = [
69
75
  process.exit(1);
70
76
  }
71
77
 
78
+ // Set AWS client defaults before any AWS operations
79
+ setAWSClientDefaults(answers.client, answers.region);
80
+
72
81
  await aws[`${answers.stack}Terminate`](
73
82
  slug,
74
- answers.client,
75
83
  _.repoSafe,
76
84
  branch,
77
85
  answers.id,
@@ -3,8 +3,9 @@ const utilities = require("../libs/utilities");
3
3
  const execSync = require("child_process").execSync;
4
4
  const inquirer = require("inquirer");
5
5
  const aws = require("../services/aws/index.js");
6
+ const { setAWSClientDefaults } = require("../services/aws/misc.js");
6
7
  const generator = require("generate-password");
7
- const { stack, client } = require("../libs/prompts.js");
8
+ const { stack, client, region } = require("../libs/prompts.js");
8
9
  const { frameworks } = require("../libs/vars");
9
10
 
10
11
  module.exports = [
@@ -56,6 +57,13 @@ module.exports = [
56
57
  message: "What availability is required?",
57
58
  choices: ["low", "high"],
58
59
  },
60
+ {
61
+ type: "confirm",
62
+ name: "database",
63
+ message: "Does this site need a database?",
64
+ default: true,
65
+ },
66
+ region,
59
67
  ])),
60
68
  };
61
69
  }
@@ -123,10 +131,12 @@ module.exports = [
123
131
  answers.stack === "static" ? "s3" : "eb",
124
132
  );
125
133
 
134
+ // Set AWS client defaults before any AWS operations
135
+ setAWSClientDefaults(answers.client, answers.region);
136
+
126
137
  try {
127
138
  infastructure = await aws[answers.stack](
128
139
  slug,
129
- answers.client,
130
140
  [
131
141
  { Key: "repository", Value: _.repo },
132
142
  { Key: "environment", Value: branch },
@@ -137,6 +147,7 @@ module.exports = [
137
147
  branch,
138
148
  answers.framework,
139
149
  answers.availability,
150
+ answers.database,
140
151
  );
141
152
  } catch (e) {
142
153
  console.log(e.message);
@@ -81,3 +81,12 @@ module.exports.client = {
81
81
  default: 0,
82
82
  loop: false,
83
83
  };
84
+
85
+ module.exports.region = {
86
+ type: "list",
87
+ name: "region",
88
+ message: "Which AWS region should be used?",
89
+ choices: ["us-east-1", "eu-west-1"],
90
+ default: 0,
91
+ validate: (input) => !!input.length,
92
+ };
@@ -209,20 +209,37 @@ module.exports.eb = {
209
209
  Value: "internal",
210
210
  Namespace: "aws:ec2:vpc",
211
211
  },
212
- {
213
- OptionName: "VPCId",
214
- Value: "vpc-d30bcca8",
215
- Namespace: "aws:ec2:vpc",
216
- },
217
- {
218
- OptionName: "Subnets",
219
- Value: "subnet-00bf5eda896fdd5c5,subnet-0aa7e40d4701683ae",
220
- Namespace: "aws:ec2:vpc",
221
- },
222
- {
223
- OptionName: "ELBSubnets",
224
- Value: "subnet-00bf5eda896fdd5c5,subnet-0aa7e40d4701683ae",
225
- Namespace: "aws:ec2:vpc",
212
+ () => {
213
+ const regions = {
214
+ "us-east-1": {
215
+ VPCId: "vpc-d30bcca8",
216
+ Subnets:
217
+ "subnet-00bf5eda896fdd5c5,subnet-0aa7e40d4701683ae",
218
+ },
219
+ "eu-west-1": {
220
+ VPCId: "vpc-cc0d9aa9",
221
+ Subnets:
222
+ "subnet-0e357f06e047e1c10,subnet-0956ffb043535455d",
223
+ },
224
+ };
225
+
226
+ return [
227
+ {
228
+ OptionName: "VPCId",
229
+ Value: regions[process.env.AWS_REGION].VPCId,
230
+ Namespace: "aws:ec2:vpc",
231
+ },
232
+ {
233
+ OptionName: "Subnets",
234
+ Value: regions[process.env.AWS_REGION].Subnets,
235
+ Namespace: "aws:ec2:vpc",
236
+ },
237
+ {
238
+ OptionName: "ELBSubnets",
239
+ Value: regions[process.env.AWS_REGION].Subnets,
240
+ Namespace: "aws:ec2:vpc",
241
+ },
242
+ ];
226
243
  },
227
244
  {
228
245
  OptionName: "AssociatePublicIpAddress",
@@ -499,26 +516,37 @@ module.exports.eb = {
499
516
  high: [],
500
517
  },
501
518
  shared: [
519
+ {
520
+ OptionName: "ServiceRole",
521
+ Value: "lab-env-aws-elasticbeanstalk-service-role",
522
+ Namespace: "aws:elasticbeanstalk:environment",
523
+ },
502
524
  {
503
525
  OptionName: "IamInstanceProfile",
504
526
  Value: "aws-elasticbeanstalk-ec2-role",
505
527
  Namespace: "aws:autoscaling:launchconfiguration",
506
528
  },
507
- {
508
- OptionName: "HasCoupledDatabase",
509
- Value: "true",
510
- Namespace: "aws:rds:dbinstance",
511
- },
512
- {
513
- OptionName: "DBEngineVersion",
514
- Value: "8.0.43",
515
- Namespace: "aws:rds:dbinstance",
516
- },
517
- {
518
- OptionName: "DBPassword",
519
- Value: generator.generate({ length: 10, numbers: true }),
520
- Namespace: "aws:rds:dbinstance",
521
- },
529
+ ({ database }) =>
530
+ database && [
531
+ {
532
+ OptionName: "HasCoupledDatabase",
533
+ Value: "true",
534
+ Namespace: "aws:rds:dbinstance",
535
+ },
536
+ {
537
+ OptionName: "DBEngineVersion",
538
+ Value: "8.0.43",
539
+ Namespace: "aws:rds:dbinstance",
540
+ },
541
+ {
542
+ OptionName: "DBPassword",
543
+ Value: generator.generate({
544
+ length: 10,
545
+ numbers: true,
546
+ }),
547
+ Namespace: "aws:rds:dbinstance",
548
+ },
549
+ ],
522
550
  ],
523
551
  low: [
524
552
  {
@@ -545,7 +573,7 @@ module.exports.eb = {
545
573
  },
546
574
  {
547
575
  OptionName: "ServiceRoleForManagedUpdates",
548
- Value: "AWSServiceRoleForElasticBeanstalkManagedUpdates",
576
+ Value: "lab-env-aws-elasticbeanstalk-service-role",
549
577
  Namespace: "aws:elasticbeanstalk:managedactions",
550
578
  },
551
579
  {
@@ -681,13 +709,13 @@ module.exports.eb = {
681
709
  high: [
682
710
  ".ebextensions/misc/alb-http-to-https-redirection.config",
683
711
  ".ebextensions/misc/enable-https-lb.config",
712
+ ".ebextensions/misc/asg-self-healing.config",
713
+ ".ebextensions/misc/health-ignore-4xx.config",
684
714
  ],
685
715
  },
686
- merge(
687
- type,
688
- { framework, availability = "low", platform, language },
689
- data = {},
690
- ) {
716
+ merge(type, config, data = {}) {
717
+ const { framework, availability = "low", platform, language } = config;
718
+
691
719
  return JSON.parse(
692
720
  template(
693
721
  JSON.stringify(
@@ -702,6 +730,10 @@ module.exports.eb = {
702
730
  this[type][framework]?.shared,
703
731
  this[type][framework]?.[availability],
704
732
  )
733
+ .map((d) =>
734
+ typeof d === "function" ? d(config, data) : d,
735
+ )
736
+ .flat()
705
737
  .filter(Boolean),
706
738
  ),
707
739
  )({ ...process.env, ...data }),
@@ -18,17 +18,15 @@ const fs = require("fs");
18
18
  const { merge } = require("lodash");
19
19
  const { Spinner, poll } = require("../../libs/utilities");
20
20
  const { cloudfront } = require("../../libs/vars");
21
- const { createClient } = require("./misc.js");
22
21
 
23
22
  module.exports.createCloudFrontDistribution = async (
24
23
  name,
25
- account,
26
24
  tags = [],
27
25
  FunctionARNRequest = null,
28
26
  FunctionARNResponse = null,
29
27
  region = "us-east-1",
30
28
  ) => {
31
- const client = createClient(CloudFrontClient, account, region);
29
+ const client = new CloudFrontClient({});
32
30
 
33
31
  let OAI = await Spinner.prototype.simple(`Creating CloudFront OAI`, () => {
34
32
  return client.send(
@@ -59,7 +57,10 @@ module.exports.createCloudFrontDistribution = async (
59
57
  ),
60
58
  Tags: {
61
59
  Items: [
62
- { Key: "client", Value: account },
60
+ {
61
+ Key: "client",
62
+ Value: process.env.AWS_PROFILE,
63
+ },
63
64
  ].concat(tags),
64
65
  },
65
66
  },
@@ -73,7 +74,6 @@ module.exports.createCloudFrontDistribution = async (
73
74
  () => {
74
75
  return module.exports.waitForCloudFrontDistribution(
75
76
  res.Distribution.Id,
76
- account,
77
77
  );
78
78
  },
79
79
  );
@@ -112,8 +112,8 @@ module.exports.createCloudFrontDistribution = async (
112
112
  return res;
113
113
  };
114
114
 
115
- module.exports.removeCloudFrontDistribution = async (Id, account) => {
116
- const client = createClient(CloudFrontClient, account);
115
+ module.exports.removeCloudFrontDistribution = async (Id) => {
116
+ const client = new CloudFrontClient({});
117
117
 
118
118
  let res = await Spinner.prototype.simple(
119
119
  `Retrieving the CloudFront distribution ${Id}`,
@@ -147,7 +147,6 @@ module.exports.removeCloudFrontDistribution = async (Id, account) => {
147
147
  () => {
148
148
  return module.exports.waitForCloudFrontDistribution(
149
149
  res.Distribution.Id,
150
- account,
151
150
  );
152
151
  },
153
152
  );
@@ -180,8 +179,8 @@ module.exports.removeCloudFrontDistribution = async (Id, account) => {
180
179
  });
181
180
  };
182
181
 
183
- module.exports.waitForCloudFrontDistribution = async (Id, account) => {
184
- const client = createClient(CloudFrontClient, account);
182
+ module.exports.waitForCloudFrontDistribution = async (Id) => {
183
+ const client = new CloudFrontClient({});
185
184
 
186
185
  await poll(
187
186
  async () => await client.send(new GetDistributionCommand({ Id })),
@@ -189,8 +188,8 @@ module.exports.waitForCloudFrontDistribution = async (Id, account) => {
189
188
  );
190
189
  };
191
190
 
192
- module.exports.createCloudFrontFunction = async (name, account, fn, config) => {
193
- const client = createClient(CloudFrontClient, account);
191
+ module.exports.createCloudFrontFunction = async (name, fn, config) => {
192
+ const client = new CloudFrontClient({});
194
193
 
195
194
  let FunctionConfig = {
196
195
  Comment: `lab-env provisioned cloudfront function for project ${name} using code snippet ${fn}.js`,
@@ -261,8 +260,8 @@ module.exports.createCloudFrontFunction = async (name, account, fn, config) => {
261
260
  return res;
262
261
  };
263
262
 
264
- module.exports.removeCloudFrontFunction = async (name, account) => {
265
- const client = createClient(CloudFrontClient, account);
263
+ module.exports.removeCloudFrontFunction = async (name) => {
264
+ const client = new CloudFrontClient({});
266
265
 
267
266
  let res = await Spinner.prototype.simple(
268
267
  `Retrieving CloudFront function`,
@@ -287,8 +286,8 @@ module.exports.removeCloudFrontFunction = async (name, account) => {
287
286
  return res;
288
287
  };
289
288
 
290
- module.exports.setCloudFrontFunctionAssociation = async (Id, account) => {
291
- const client = createClient(CloudFrontClient, account);
289
+ module.exports.setCloudFrontFunctionAssociation = async (Id) => {
290
+ const client = new CloudFrontClient({});
292
291
 
293
292
  let res = await Spinner.prototype.simple(
294
293
  `Retrieving CloudFront distribution`,
@@ -339,14 +338,13 @@ module.exports.setCloudFrontFunctionAssociation = async (Id, account) => {
339
338
  () => {
340
339
  return module.exports.waitForCloudFrontDistribution(
341
340
  res.Distribution.Id,
342
- account,
343
341
  );
344
342
  },
345
343
  );
346
344
  };
347
345
 
348
- module.exports.removeCloudFrontFunctionAssociation = async (Id, account) => {
349
- const client = createClient(CloudFrontClient, account);
346
+ module.exports.removeCloudFrontFunctionAssociation = async (Id) => {
347
+ const client = new CloudFrontClient({});
350
348
 
351
349
  let res = await Spinner.prototype.simple(
352
350
  `Retrieving CloudFront distribution`,
@@ -379,7 +377,6 @@ module.exports.removeCloudFrontFunctionAssociation = async (Id, account) => {
379
377
  () => {
380
378
  return module.exports.waitForCloudFrontDistribution(
381
379
  res.Distribution.Id,
382
- account,
383
380
  );
384
381
  },
385
382
  );
@@ -1,9 +1,8 @@
1
1
  const { EC2Client, DescribeKeyPairsCommand } = require("@aws-sdk/client-ec2");
2
2
  const { Spinner } = require("../../libs/utilities");
3
- const { createClient } = require("./misc.js");
4
3
 
5
- module.exports.getKeyPair = async (KeyName, account) => {
6
- const client = createClient(EC2Client, account);
4
+ module.exports.getKeyPair = async (KeyName) => {
5
+ const client = new EC2Client({});
7
6
 
8
7
  let res = await Spinner.prototype.simple(
9
8
  `Retrieving the KeyPair ${KeyName}`,