Skip to content
This repository was archived by the owner on Apr 13, 2020. It is now read-only.

Commit 7f8c58e

Browse files
authored
[BUG-FIX] do not prompt for key vault value in spk init command (#492)
1 parent e12df0a commit 7f8c58e

File tree

4 files changed

+2
-21
lines changed

4 files changed

+2
-21
lines changed

docs/commands/data.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"defaultValue": false
1515
}
1616
],
17-
"markdown": "This command creates a configuration file, `config.yaml` in a folder `.spk`\nunder your home directory. There are two options for creating this file\n\n1. an interactive mode where you have to answer a few questions; and\n2. you provide a `yaml` file and this `yaml` will be copied to the target\n location.\n\n## Interactive mode\n\nThe command line tool attempts to read `config.yaml` in a folder `.spk` under\nyour home directory. Configuration values shall be read from it if it exists.\nAnd these values shall be default values for the questions. Otherwise, there\nshall be no default values. These are the questions\n\n1. Organization Name of Azure dev-op account\n2. Project Name of Azure dev-op account\n3. Personal Access Token (guides)\n4. Would like to have introspection configuration setup? If yes\n 1. Storage Account Name\n 1. Storage Table Name\n 1. Storage Partition Key\n 1. Storage Access Key\n 1. Key Vault Name (optional)\n\nThis tool shall verify these values by making an API call to Azure dev-op. They\nshall be written to `config.yaml` regardless the verification is successful or\nnot.\n\n> Note: In the event that you do not have internet connection, this verification\n> shall not be possible\n\n## Example\n\n```\nspk init --interactive\n```\n\nor\n\n```\nspk init --file myConfig.yaml\n```\n"
17+
"markdown": "This command creates a configuration file, `config.yaml` in a folder `.spk`\nunder your home directory. There are two options for creating this file\n\n1. an interactive mode where you have to answer a few questions; and\n2. you provide a `yaml` file and this `yaml` will be copied to the target\n location.\n\n## Interactive mode\n\nThe command line tool attempts to read `config.yaml` in a folder `.spk` under\nyour home directory. Configuration values shall be read from it if it exists.\nAnd these values shall be default values for the questions. Otherwise, there\nshall be no default values. These are the questions\n\n1. Organization Name of Azure dev-op account\n2. Project Name of Azure dev-op account\n3. Personal Access Token (guides)\n4. Would like to have introspection configuration setup? If yes\n 1. Storage Account Name\n 1. Storage Table Name\n 1. Storage Partition Key\n 1. Storage Access Key\n\nThis tool shall verify these values by making an API call to Azure dev-op. They\nshall be written to `config.yaml` regardless the verification is successful or\nnot.\n\n> Note: In the event that you do not have internet connection, this verification\n> shall not be possible\n\n## Example\n\n```\nspk init --interactive\n```\n\nor\n\n```\nspk init --file myConfig.yaml\n```\n"
1818
},
1919
"setup": {
2020
"command": "setup",

src/commands/init.md

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ shall be no default values. These are the questions
2020
1. Storage Table Name
2121
1. Storage Partition Key
2222
1. Storage Access Key
23-
1. Key Vault Name (optional)
2423

2524
This tool shall verify these values by making an API call to Azure dev-op. They
2625
shall be written to `config.yaml` regardless the verification is successful or

src/commands/init.test.ts

+1-11
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,7 @@ describe("test prompt function", () => {
228228
});
229229

230230
const testHandleIntrospectionInteractive = async (
231-
withIntrospection = false,
232-
withKeyVault = false
231+
withIntrospection = false
233232
): Promise<void> => {
234233
const config: ConfigYaml = {};
235234
if (!withIntrospection) {
@@ -242,26 +241,17 @@ const testHandleIntrospectionInteractive = async (
242241
azdo_storage_table_name: "storagetabletest",
243242
azdo_storage_partition_key: "test1234key",
244243
azdo_storage_access_key: "accessKey",
245-
azdo_storage_key_vault_name: withKeyVault ? "keyvault" : "",
246244
});
247245
await handleIntrospectionInteractive(config);
248246
expect(config.introspection?.azure?.account_name).toBe("storagetest");
249247
expect(config.introspection?.azure?.table_name).toBe("storagetabletest");
250248
expect(config.introspection?.azure?.partition_key).toBe("test1234key");
251249
expect(config.introspection?.azure?.key).toBe("accessKey");
252-
253-
if (withKeyVault) {
254-
expect(config.key_vault_name).toBe("keyvault");
255-
} else {
256-
expect(config.key_vault_name).toBeUndefined();
257-
}
258250
};
259251

260252
describe("test handleIntrospectionInteractive function", () => {
261253
it("positive test", async () => {
262254
await testHandleIntrospectionInteractive(false);
263255
await testHandleIntrospectionInteractive(true);
264-
await testHandleIntrospectionInteractive(false, true);
265-
await testHandleIntrospectionInteractive(true, true);
266256
});
267257
});

src/commands/init.ts

-8
Original file line numberDiff line numberDiff line change
@@ -138,19 +138,11 @@ export const handleIntrospectionInteractive = async (
138138
promptBuilder.azureStorageTableName(azure.table_name),
139139
promptBuilder.azureStoragePartitionKey(azure.partition_key),
140140
promptBuilder.azureStorageAccessKey(azure.key),
141-
promptBuilder.azureKeyVaultName(curConfig.key_vault_name),
142141
]);
143142
azure["account_name"] = ans.azdo_storage_account_name;
144143
azure["table_name"] = ans.azdo_storage_table_name;
145144
azure["partition_key"] = ans.azdo_storage_partition_key;
146145
azure.key = ans.azdo_storage_access_key;
147-
148-
const keyVaultName = ans.azdo_storage_key_vault_name.trim();
149-
if (keyVaultName) {
150-
curConfig["key_vault_name"] = keyVaultName;
151-
} else {
152-
delete curConfig["key_vault_name"];
153-
}
154146
};
155147

156148
/**

0 commit comments

Comments
 (0)