diff --git a/src/backend/importer.js b/src/backend/importer.js index b6699e32..8e47ea4e 100644 --- a/src/backend/importer.js +++ b/src/backend/importer.js @@ -354,7 +354,7 @@ module.exports = function () { .insertAndFetch({ owner_user_id: 1, domain_names: [host.hostname], - forward_ip: host.forward_server, + forward_host: host.forward_server, forward_port: host.forward_port, access_list_id: access_list_id, certificate_id: certificate_id, diff --git a/src/backend/migrations/20181019052346_forward_host.js b/src/backend/migrations/20181019052346_forward_host.js new file mode 100644 index 00000000..1ca4d0fc --- /dev/null +++ b/src/backend/migrations/20181019052346_forward_host.js @@ -0,0 +1,36 @@ +'use strict'; + +const migrate_name = 'forward_host'; +const logger = require('../logger').migrate; + +/** + * Migrate + * + * @see http://knexjs.org/#Schema + * + * @param {Object} knex + * @param {Promise} Promise + * @returns {Promise} + */ +exports.up = function (knex/*, Promise*/) { + logger.info('[' + migrate_name + '] Migrating Up...'); + + return knex.schema.table('proxy_host', function (proxy_host) { + proxy_host.renameColumn('forward_ip', 'forward_host'); + }) + .then(() => { + logger.info('[' + migrate_name + '] proxy_host Table altered'); + }); +}; + +/** + * Undo Migrate + * + * @param {Object} knex + * @param {Promise} Promise + * @returns {Promise} + */ +exports.down = function (knex, Promise) { + logger.warn('[' + migrate_name + '] You can\'t migrate down this one.'); + return Promise.resolve(true); +}; \ No newline at end of file diff --git a/src/backend/schema/endpoints/proxy-hosts.json b/src/backend/schema/endpoints/proxy-hosts.json index 11155f09..a7e3e30e 100644 --- a/src/backend/schema/endpoints/proxy-hosts.json +++ b/src/backend/schema/endpoints/proxy-hosts.json @@ -18,9 +18,10 @@ "domain_names": { "$ref": "../definitions.json#/definitions/domain_names" }, - "forward_ip": { + "forward_host": { "type": "string", - "format": "ipv4" + "minLength": 1, + "maxLength": 50 }, "forward_port": { "type": "integer", @@ -67,8 +68,8 @@ "domain_names": { "$ref": "#/definitions/domain_names" }, - "forward_ip": { - "$ref": "#/definitions/forward_ip" + "forward_host": { + "$ref": "#/definitions/forward_host" }, "forward_port": { "$ref": "#/definitions/forward_port" @@ -131,15 +132,15 @@ "additionalProperties": false, "required": [ "domain_names", - "forward_ip", + "forward_host", "forward_port" ], "properties": { "domain_names": { "$ref": "#/definitions/domain_names" }, - "forward_ip": { - "$ref": "#/definitions/forward_ip" + "forward_host": { + "$ref": "#/definitions/forward_host" }, "forward_port": { "$ref": "#/definitions/forward_port" @@ -193,8 +194,8 @@ "domain_names": { "$ref": "#/definitions/domain_names" }, - "forward_ip": { - "$ref": "#/definitions/forward_ip" + "forward_host": { + "$ref": "#/definitions/forward_host" }, "forward_port": { "$ref": "#/definitions/forward_port" diff --git a/src/backend/templates/proxy_host.conf b/src/backend/templates/proxy_host.conf index da4dfdc3..b8a301d7 100644 --- a/src/backend/templates/proxy_host.conf +++ b/src/backend/templates/proxy_host.conf @@ -1,7 +1,7 @@ {% include "_header_comment.conf" %} server { - set $server {{ forward_ip }}; + set $server "{{ forward_host }}"; set $port {{ forward_port }}; {% include "_listen.conf" %} diff --git a/src/frontend/js/app/nginx/proxy/form.ejs b/src/frontend/js/app/nginx/proxy/form.ejs index 5a85cd8f..31828846 100644 --- a/src/frontend/js/app/nginx/proxy/form.ejs +++ b/src/frontend/js/app/nginx/proxy/form.ejs @@ -22,8 +22,8 @@