@@ -16,6 +16,7 @@ const Settings = require('@microsoft/bf-lu/lib/parser/lubuild/settings')
1616const MultiLanguageRecognizer = require ( '@microsoft/bf-lu/lib/parser/lubuild/multi-language-recognizer' )
1717const Recognizer = require ( '@microsoft/bf-lu/lib/parser/lubuild/recognizer' )
1818const Builder = require ( '@microsoft/bf-lu/lib/parser/lubuild/builder' ) . Builder
19+ const utils = require ( '../../utils/index' )
1920
2021export default class LuisBuild extends Command {
2122 static description = 'Build lu files to train and publish luis applications'
@@ -27,7 +28,7 @@ export default class LuisBuild extends Command {
2728 static flags : flags . Input < any > = {
2829 help : flags . help ( { char : 'h' } ) ,
2930 in : flags . string ( { char : 'i' , description : 'Lu file or folder' } ) ,
30- authoringKey : flags . string ( { description : 'LUIS authoring key' , required : true } ) ,
31+ authoringKey : flags . string ( { description : 'LUIS authoring key' } ) ,
3132 botName : flags . string ( { description : 'Bot name' } ) ,
3233 region : flags . string ( { description : 'LUIS authoring region [westus|westeurope|australiaeast]' , default : 'westus' } ) ,
3334 out : flags . string ( { char : 'o' , description : 'Output file or folder name. If not specified, current directory will be used as output' } ) ,
@@ -43,6 +44,7 @@ export default class LuisBuild extends Command {
4344 async run ( ) {
4445 try {
4546 const { flags} = this . parse ( LuisBuild )
47+ const userConfig = await utils . getUserConfig ( this . config . configDir )
4648
4749 flags . stdin = await this . readStdin ( )
4850
@@ -66,6 +68,12 @@ export default class LuisBuild extends Command {
6668 throw new CLIError ( 'Missing input. Please use stdin or pass a file or folder location with --in flag' )
6769 }
6870
71+ if ( ! flags . authoringKey && ( ! userConfig || ! userConfig . authoringKey ) ) {
72+ throw new CLIError ( 'Missing luis authoring key. Please pass authoring key with --authoringKey flag' )
73+ } else {
74+ flags . authoringKey = flags . authoringKey || userConfig . authoringKey
75+ }
76+
6977 if ( ! flags . botName ) {
7078 throw new CLIError ( 'Missing bot name. Please pass bot name with --botName flag' )
7179 }
0 commit comments