diff --git a/src/nginxconfig/generators/index.js b/src/nginxconfig/generators/index.js index 22276b0..f822042 100644 --- a/src/nginxconfig/generators/index.js +++ b/src/nginxconfig/generators/index.js @@ -1,22 +1,13 @@ import toConf from './to_conf'; import nginxConf from './nginx.conf'; -const toConfig = obj => { - // Convert the obj to nginx - const rawConf = toConf(obj); - - // Do some magic to comments - const commentConf = rawConf - .replace(/^([^\S\r\n]*[^#\s].*[^\n])\n([^\S\r\n]*)#/gm, '$1\n\n$2#') // Double linebreak before comment - .replace(/^([^\S\r\n]*#.*\n[^\S\r\n]*#.*\n)([^\S\r\n]*[^#\s])/gm, '$1\n$2') // Double linebreak after double comment - - return commentConf; -} +// Convert the data to nginx conf and do some magic to comments +const toConfig = entriesOrObject => toConf(entriesOrObject) + .replace(/^([^\S\r\n]*[^#\s].*[^\n])\n([^\S\r\n]*)#/gm, '$1\n\n$2#') // Double linebreak before comment + .replace(/^([^\S\r\n]*#.*\n[^\S\r\n]*#.*\n)([^\S\r\n]*[^#\s])/gm, '$1\n$2'); // Double linebreak after double comment export default (domains, global) => { - const files = {}; - - files['nginx.conf'] = toConfig(nginxConf(domains, global)); - + const files = []; + files.push(['nginx.conf', toConfig(nginxConf(domains, global))]); return files; -} +}; diff --git a/src/nginxconfig/generators/to_conf.js b/src/nginxconfig/generators/to_conf.js index bde6688..af50a00 100644 --- a/src/nginxconfig/generators/to_conf.js +++ b/src/nginxconfig/generators/to_conf.js @@ -46,6 +46,6 @@ const recurse = (entriesOrObject, depth) => { } return retVal.replace(/\n\n\n/g, '\n\n'); -} +}; export default entriesOrObject => recurse(entriesOrObject, 0); diff --git a/src/nginxconfig/templates/app.vue b/src/nginxconfig/templates/app.vue index fd64c74..db2ed87 100644 --- a/src/nginxconfig/templates/app.vue +++ b/src/nginxconfig/templates/app.vue @@ -63,9 +63,9 @@ limitations under the License.

Config files

-