Repository: awslabs/aws-ddk (language: python)

Issue:
bug: get_env_config under Configurator doesn't work as expected
### Describe the bug

The static function get_env_config under configurator returns None when used to retrieve env specific config

The below line of code will return None as the output
Configurator.get_env_config(config_path="./ddk.json", environment_id="dev")

The issue is line 132 here: https://github.com/awslabs/aws-ddk/blob/dbc8bfc92fc609e6f1e20d50a11b9398cbd8f0c0/src/config/configurator.ts#L132

The structure of ddk.json has environments followed by cicd, dev etc, the above code ignores the key environments and hence the for e.g dev the above code translates to `return getConfig({ config: props.configPath })["dev"]` instead of `return getConfig({ config: props.configPath })["environments"]["dev"]`

Due to the above bug, the functionality is not usable



### How to Reproduce

```
Configurator.get_env_config(config_path="./ddk.json", environment_id="dev")

```


### Expected behavior

Return env specific parameter part of config from ddk.json instead of None

### Your project

_No response_

### Screenshots

_No response_

### Environment

```
Provide your `pip list` output, particularly the version of the AWS DDK library you used. Providing this information may significantly improve resolution times.
```


### OS

Mac

### Python version

3.9

### AWS DDK version

1.0.0b

### Additional context

_No response_


Discussion / hints:

Fix patch:
diff --git a/src/config/configurator.ts b/src/config/configurator.ts
index 5f84b272..48739bc2 100644
--- a/src/config/configurator.ts
+++ b/src/config/configurator.ts
@@ -129,7 +129,8 @@ export interface GetEnvConfigProps {
 
 export class Configurator {
   public static getEnvConfig(props: GetEnvConfigProps): any {
-    return getConfig({ config: props.configPath })[props.environmentId];
+    const config = getConfig({ config: props.configPath });
+    return config.environments ? config.environments[props.environmentId] : undefined;
   }
   public readonly config: any;
   public readonly environmentId?: string;


Test patch:
diff --git a/test/config.test.ts b/test/config.test.ts
index 79ec01ce..285bf47c 100644
--- a/test/config.test.ts
+++ b/test/config.test.ts
@@ -381,34 +381,18 @@ test("Get Env Config", () => {
 
 test("Get Env Config Static Method", () => {
   const config = Configurator.getEnvConfig({ configPath: "./test/test-config.yaml", environmentId: "dev" });
+  const nullConfig = Configurator.getEnvConfig({ configPath: "./ddk.json", environmentId: "dev" });
   const expectedDevConfig = {
-    tags: {
-      "global:foo": "bar",
-    },
-    environments: {
-      dev: {
-        account: "222222222222",
-        region: "us-east-1",
-        resources: {
-          "AWS::Lambda::Function": {
-            MemorySize: 128,
-            Runtime: "python3.8",
-          },
-        },
-        tags: { CostCenter: "2014" },
-      },
-      prod: {
-        account: "222222222222",
-        region: "us-east-1",
-        resources: {
-          "AWS::Lambda::Function": {
-            MemorySize: 1024,
-            Runtime: "python3.8",
-          },
-        },
-        tags: { CostCenter: "2015" },
+    account: "222222222222",
+    region: "us-east-1",
+    resources: {
+      "AWS::Lambda::Function": {
+        MemorySize: 128,
+        Runtime: "python3.8",
       },
     },
+    tags: { CostCenter: "2014" },
   };
   assert(config === expectedDevConfig);
+  assert(nullConfig === undefined);
 });