@@ -136,6 +136,8 @@ const internalNginx = {
136136 * @returns {Promise }
137137 */
138138 renderLocations : ( host ) => {
139+
140+ //logger.info('host = ' + JSON.stringify(host, null, 2));
139141 return new Promise ( ( resolve , reject ) => {
140142 let template ;
141143
@@ -146,26 +148,36 @@ const internalNginx = {
146148 return ;
147149 }
148150
149- let renderer = new Liquid ( ) ;
151+ let renderer = new Liquid ( {
152+ root : __dirname + '/../templates/'
153+ } ) ;
150154 let renderedLocations = '' ;
151155
152156 const locationRendering = async ( ) => {
153157 for ( let i = 0 ; i < host . locations . length ; i ++ ) {
154- let locationCopy = Object . assign ( { } , host . locations [ i ] ) ;
155-
158+ let locationCopy = Object . assign ( { } , { access_list_id : host . access_list_id } , { certificate_id : host . certificate_id } ,
159+ { ssl_forced : host . ssl_forced } , { caching_enabled : host . caching_enabled } , { block_exploits : host . block_exploits } ,
160+ { allow_websocket_upgrade : host . allow_websocket_upgrade } , { http2_support : host . http2_support } ,
161+ { hsts_enabled : host . hsts_enabled } , { hsts_subdomains : host . hsts_subdomains } , { access_list : host . access_list } ,
162+ { certificate : host . certificate } , host . locations [ i ] ) ;
163+
156164 if ( locationCopy . forward_host . indexOf ( '/' ) > - 1 ) {
157165 const splitted = locationCopy . forward_host . split ( '/' ) ;
158166
159167 locationCopy . forward_host = splitted . shift ( ) ;
160168 locationCopy . forward_path = `/${ splitted . join ( '/' ) } ` ;
161169 }
162170
171+ //logger.info('locationCopy = ' + JSON.stringify(locationCopy, null, 2));
172+
163173 // eslint-disable-next-line
164174 renderedLocations += await renderer . parseAndRender ( template , locationCopy ) ;
165175 }
176+
166177 } ;
167178
168179 locationRendering ( ) . then ( ( ) => resolve ( renderedLocations ) ) ;
180+
169181 } ) ;
170182 } ,
171183
@@ -181,6 +193,8 @@ const internalNginx = {
181193 logger . info ( 'Generating ' + host_type + ' Config:' , host ) ;
182194 }
183195
196+ // logger.info('host = ' + JSON.stringify(host, null, 2));
197+
184198 let renderEngine = new Liquid ( {
185199 root : __dirname + '/../templates/'
186200 } ) ;
@@ -208,6 +222,7 @@ const internalNginx = {
208222 }
209223
210224 if ( host . locations ) {
225+ //logger.info ('host.locations = ' + JSON.stringify(host.locations, null, 2));
211226 origLocations = [ ] . concat ( host . locations ) ;
212227 locationsPromise = internalNginx . renderLocations ( host ) . then ( ( renderedLocations ) => {
213228 host . locations = renderedLocations ;
0 commit comments