mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-08-08 10:23:37 +00:00
Add support for proxy_protocol in proxy_hosts and streams
Closes #1114 Related To #1882 Related To #3537 Related To #3618 Co-authored-by: jwklijnsma <janwiebe@janwiebe.eu> Co-authored-by: SBado <16034687+SBado@users.noreply.github.com>
This commit is contained in:
56
backend/migrations/20241022221324_proxy_protocol.js
Normal file
56
backend/migrations/20241022221324_proxy_protocol.js
Normal file
@@ -0,0 +1,56 @@
|
||||
const migrate_name = 'proxy_protocol';
|
||||
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.integer('proxy_protocol_enabled').notNull().defaultTo(0);
|
||||
proxy_host.string('loadbalancer_address').notNull().defaultTo('');
|
||||
})
|
||||
.then(() => {
|
||||
logger.info('[' + migrate_name + '] proxy_host Table altered');
|
||||
|
||||
return knex.schema.table('stream', function (stream) {
|
||||
stream.integer('proxy_protocol_enabled').notNull().defaultTo(0);
|
||||
stream.string('loadbalancer_address').notNull().defaultTo('');
|
||||
})
|
||||
.then(() => {
|
||||
logger.info('[' + migrate_name + '] stream Table altered');
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Undo Migrate
|
||||
*
|
||||
* @param {Object} knex
|
||||
* @param {Promise} Promise
|
||||
* @returns {Promise}
|
||||
*/
|
||||
exports.down = function (knex/*, Promise*/) {
|
||||
return knex.schema.table('proxy_host', function (proxy_host) {
|
||||
proxy_host.dropColumn('proxy_protocol_enabled');
|
||||
proxy_host.dropColumn('loadbalancer_address');
|
||||
})
|
||||
.then(function () {
|
||||
logger.info('[' + migrate_name + '] proxy_host Table altered');
|
||||
return knex.schema.table('stream', function (stream) {
|
||||
stream.dropColumn('proxy_protocol_enabled');
|
||||
stream.dropColumn('loadbalancer_address');
|
||||
})
|
||||
.then(function () {
|
||||
logger.info('[' + migrate_name + '] stream Table altered');
|
||||
});
|
||||
});
|
||||
};
|
Reference in New Issue
Block a user