auto create nginx temp folder

This commit is contained in:
Daniel Herrero 2018-02-07 09:51:51 +01:00
parent 93ef3c7fea
commit c099d3f021
1 changed files with 7 additions and 2 deletions

View File

@ -191,6 +191,11 @@ gulp.task('nginx-stop', ['nginx-conf'], async () => {
gulp.task('nginx-conf', async () => {
const mustache = require('mustache');
// crear carpeta nginx &{nginxTemp} si no existe
if (!fs.existsSync(nginxTemp)) {
fs.mkdirSync(nginxTemp);
}
let params = {
services: await getServices(),
defaultService: defaultService,
@ -208,12 +213,12 @@ gulp.task('nginx-conf', async () => {
let template = await fs.readFile(confFile, 'utf8');
let nginxConf = mustache.render(template, params);
await fs.writeFile(`${nginxDir}/temp/nginx.conf`, nginxConf);
await fs.writeFile(`${nginxTemp}/nginx.conf`, nginxConf);
});
gulp.task('nginx-clean', () => {
const del = require('del');
return del([`${nginxDir}/temp/*`], {force: true});
return del([`${nginxTemp}/*`], {force: true});
});
let services;