@@ -136,6 +136,8 @@ const internalNginx = {
136
136
* @returns {Promise }
137
137
*/
138
138
renderLocations : ( host ) => {
139
+
140
+ //logger.info('host = ' + JSON.stringify(host, null, 2));
139
141
return new Promise ( ( resolve , reject ) => {
140
142
let template ;
141
143
@@ -146,26 +148,36 @@ const internalNginx = {
146
148
return ;
147
149
}
148
150
149
- let renderer = new Liquid ( ) ;
151
+ let renderer = new Liquid ( {
152
+ root : __dirname + '/../templates/'
153
+ } ) ;
150
154
let renderedLocations = '' ;
151
155
152
156
const locationRendering = async ( ) => {
153
157
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
+
156
164
if ( locationCopy . forward_host . indexOf ( '/' ) > - 1 ) {
157
165
const splitted = locationCopy . forward_host . split ( '/' ) ;
158
166
159
167
locationCopy . forward_host = splitted . shift ( ) ;
160
168
locationCopy . forward_path = `/${ splitted . join ( '/' ) } ` ;
161
169
}
162
170
171
+ //logger.info('locationCopy = ' + JSON.stringify(locationCopy, null, 2));
172
+
163
173
// eslint-disable-next-line
164
174
renderedLocations += await renderer . parseAndRender ( template , locationCopy ) ;
165
175
}
176
+
166
177
} ;
167
178
168
179
locationRendering ( ) . then ( ( ) => resolve ( renderedLocations ) ) ;
180
+
169
181
} ) ;
170
182
} ,
171
183
@@ -181,6 +193,8 @@ const internalNginx = {
181
193
logger . info ( 'Generating ' + host_type + ' Config:' , host ) ;
182
194
}
183
195
196
+ // logger.info('host = ' + JSON.stringify(host, null, 2));
197
+
184
198
let renderEngine = new Liquid ( {
185
199
root : __dirname + '/../templates/'
186
200
} ) ;
@@ -208,6 +222,7 @@ const internalNginx = {
208
222
}
209
223
210
224
if ( host . locations ) {
225
+ //logger.info ('host.locations = ' + JSON.stringify(host.locations, null, 2));
211
226
origLocations = [ ] . concat ( host . locations ) ;
212
227
locationsPromise = internalNginx . renderLocations ( host ) . then ( ( renderedLocations ) => {
213
228
host . locations = renderedLocations ;
0 commit comments