import args from "args" ; import IQueueEnvironment from "./IQueueEnvironment" ; import { DEFAULT_QUEUE_LISTENING_PORT , DEFAULT_QUEUE_SERVER_HOST_NAME } from "./utils/constants" ; args . option ( [ "" , "queueHost" ] , "Optional. Customize listening address for queue" , DEFAULT_QUEUE_SERVER_HOST_NAME ) . option ( [ "" , "queuePort" ] , "Optional. Customize listening port for queue" , DEFAULT_QUEUE_LISTENING_PORT ) . option ( [ "l" , "location" ] , "Optional. Use an existing folder as workspace path, default is current working directory" , process . cwd ( ) ) . option ( [ "s" , "silent" ] , "Optional. Disable access log displayed in console" ) . option ( [ "L" , "loose" ] , "Optional. Enable loose mode which ignores unsupported headers and parameters" ) . option ( [ "" , "disableProductStyleUrl" ] , "Optional. DDisable getting account name from the host of request Uri, always get account name from the first path segment of request Uri." ) . option ( [ "" , "skipApiVersionCheck" ] , "Optional. Skip the request API version check, request with all Api versions will be allowed" ) . option ( [ "" , "oauth" ] , 'Optional. OAuth level. Candidate values: "basic"' ) . option ( [ "" , "cert" ] , "Optional. Path to certificate file" ) . option ( [ "" , "key" ] , "Optional. Path to certificate key .pem file" ) . option ( [ "" , "pwd" ] , "Optional. Password for .pfx file" ) . option ( [ "d" , "debug" ] , "Optional. Enable debug log by providing a valid local file path as log destination" ) ; ( args as any ) . config . name = "azurite-queue" ; export default class QueueEnvironment implements IQueueEnvironment { private flags = args . parse ( process . argv ) ; public queueHost ( ) { return this . flags . queueHost ; } public queuePort ( ) { return this . flags . queuePort ; } public async location ( ) { return this . flags . location || process . cwd ( ) ; } public silent ( ) { if ( this . flags . silent !== undefined ) { return true ; } return false ; } public loose ( ) { if ( this . flags . loose !== undefined ) { return true ; } return false ; } public skipApiVersionCheck ( ) { if ( this . flags . skipApiVersionCheck !== undefined ) { return true ; } return false ; } public cert ( ) { return this . flags . cert ; } public key ( ) { return this . flags . key ; } public pwd ( ) { return this . flags . pwd ; } public oauth ( ) { return this . flags . oauth ; } public disableProductStyleUrl ( ) { if ( this . flags . disableProductStyleUrl !== undefined ) { return true ; } return false ; } public async debug ( ) { if ( typeof this . flags . debug === "string" ) { return this . flags . debug ; } if ( this . flags . debug === true ) { throw RangeError ( `Must provide a debug log file path for parameter -d or --debug` ) ; } } }