@@ -16,6 +16,7 @@ import { intro, isCancel, spinner, text } from '@clack/prompts';
16
16
import { inverse , yellow , magenta , green , red } from 'picocolors' ;
17
17
import fetch from 'node-fetch' ;
18
18
import { fromTemplateFlags } from '../../core/flags/generate/fromTemplate.flags' ;
19
+ import { proxyFlags } from '../../core/flags/proxy.flags' ;
19
20
20
21
interface IMapBaseUrlToFlag {
21
22
url : string ,
@@ -57,7 +58,10 @@ export default class Template extends Command {
57
58
'asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template --param version=1.0.0 singleFile=true --output ./docs --force-write'
58
59
] ;
59
60
60
- static flags = fromTemplateFlags ( ) ;
61
+ static readonly flags = {
62
+ ...fromTemplateFlags ( ) ,
63
+ ...proxyFlags ( )
64
+ } ;
61
65
62
66
static args = {
63
67
asyncapi : Args . string ( { description : '- Local path, url or context-name pointing to AsyncAPI file' , required : true } ) ,
@@ -72,6 +76,7 @@ export default class Template extends Command {
72
76
73
77
let { asyncapi, template } = args ;
74
78
let output = flags . output as string ;
79
+ const { proxyPort, proxyHost} = flags ;
75
80
if ( interactive ) {
76
81
intro ( inverse ( 'AsyncAPI Generator' ) ) ;
77
82
@@ -96,6 +101,11 @@ export default class Template extends Command {
96
101
token : flags [ 'registry-token' ]
97
102
}
98
103
} ;
104
+
105
+ if ( proxyHost && proxyPort ) {
106
+ const proxyUrl = `http://${ proxyHost } :${ proxyPort } ` ;
107
+ asyncapi = `${ asyncapi } +${ proxyUrl } ` ;
108
+ }
99
109
const asyncapiInput = ( await load ( asyncapi ) ) || ( await load ( ) ) ;
100
110
101
111
this . specFile = asyncapiInput ;
0 commit comments