diff --git a/docs/commands/data.json b/docs/commands/data.json index bc5bb8ed1..c1db30894 100644 --- a/docs/commands/data.json +++ b/docs/commands/data.json @@ -14,7 +14,7 @@ "defaultValue": false } ], - "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" + "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" }, "setup": { "command": "setup", diff --git a/src/commands/init.md b/src/commands/init.md index f5d8ba46a..11459b952 100644 --- a/src/commands/init.md +++ b/src/commands/init.md @@ -20,7 +20,6 @@ shall be no default values. These are the questions 1. Storage Table Name 1. Storage Partition Key 1. Storage Access Key - 1. Key Vault Name (optional) This tool shall verify these values by making an API call to Azure dev-op. They shall be written to `config.yaml` regardless the verification is successful or diff --git a/src/commands/init.test.ts b/src/commands/init.test.ts index 9696d839e..97d134cd1 100644 --- a/src/commands/init.test.ts +++ b/src/commands/init.test.ts @@ -228,8 +228,7 @@ describe("test prompt function", () => { }); const testHandleIntrospectionInteractive = async ( - withIntrospection = false, - withKeyVault = false + withIntrospection = false ): Promise => { const config: ConfigYaml = {}; if (!withIntrospection) { @@ -242,26 +241,17 @@ const testHandleIntrospectionInteractive = async ( azdo_storage_table_name: "storagetabletest", azdo_storage_partition_key: "test1234key", azdo_storage_access_key: "accessKey", - azdo_storage_key_vault_name: withKeyVault ? "keyvault" : "", }); await handleIntrospectionInteractive(config); expect(config.introspection?.azure?.account_name).toBe("storagetest"); expect(config.introspection?.azure?.table_name).toBe("storagetabletest"); expect(config.introspection?.azure?.partition_key).toBe("test1234key"); expect(config.introspection?.azure?.key).toBe("accessKey"); - - if (withKeyVault) { - expect(config.key_vault_name).toBe("keyvault"); - } else { - expect(config.key_vault_name).toBeUndefined(); - } }; describe("test handleIntrospectionInteractive function", () => { it("positive test", async () => { await testHandleIntrospectionInteractive(false); await testHandleIntrospectionInteractive(true); - await testHandleIntrospectionInteractive(false, true); - await testHandleIntrospectionInteractive(true, true); }); }); diff --git a/src/commands/init.ts b/src/commands/init.ts index 94e23e058..fa8c2bea2 100644 --- a/src/commands/init.ts +++ b/src/commands/init.ts @@ -138,19 +138,11 @@ export const handleIntrospectionInteractive = async ( promptBuilder.azureStorageTableName(azure.table_name), promptBuilder.azureStoragePartitionKey(azure.partition_key), promptBuilder.azureStorageAccessKey(azure.key), - promptBuilder.azureKeyVaultName(curConfig.key_vault_name), ]); azure["account_name"] = ans.azdo_storage_account_name; azure["table_name"] = ans.azdo_storage_table_name; azure["partition_key"] = ans.azdo_storage_partition_key; azure.key = ans.azdo_storage_access_key; - - const keyVaultName = ans.azdo_storage_key_vault_name.trim(); - if (keyVaultName) { - curConfig["key_vault_name"] = keyVaultName; - } else { - delete curConfig["key_vault_name"]; - } }; /**