migrations
This commit is contained in:
parent
5266aec2b1
commit
1bf358565a
17
nodejs/migrations/1.js
Normal file
17
nodejs/migrations/1.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
'use ';
|
||||||
|
|
||||||
|
const client = require('../utils/redis');
|
||||||
|
|
||||||
|
(async function(){
|
||||||
|
await client.rename('proxy_hosts', 'proxy_host');
|
||||||
|
let hosts = await client.SMEMBERS('proxy_host');
|
||||||
|
|
||||||
|
for(let host of hosts){
|
||||||
|
let user = await client.HGET('proxy_host_'+host, 'username');
|
||||||
|
await client.HSET('proxy_host_'+host, 'created_by', user);
|
||||||
|
let created_on = client.HGET('proxy_host_'+host, 'updated');
|
||||||
|
await client.HSET('proxy_host_'+host, 'created_on', created_on);
|
||||||
|
await client.HDEL('proxy_host_'+host, 'username');
|
||||||
|
await client.HDEL('proxy_host_'+host, 'updated')
|
||||||
|
}
|
||||||
|
})()
|
@ -10,7 +10,7 @@ const Host = require('../utils/redis_model')({
|
|||||||
'updated_on': {default: function(){return (new Date).getTime()}, always: true},
|
'updated_on': {default: function(){return (new Date).getTime()}, always: true},
|
||||||
'host': {isRequired: true, type: 'string', min: 3, max: 500},
|
'host': {isRequired: true, type: 'string', min: 3, max: 500},
|
||||||
'ip': {isRequired: true, type: 'string', min: 3, max: 500},
|
'ip': {isRequired: true, type: 'string', min: 3, max: 500},
|
||||||
'targetport': {isRequired: true, type: 'number', min:0, max:65535},
|
'targetPort': {isRequired: true, type: 'number', min:0, max:65535},
|
||||||
'forcessl': {isRequired: false, default: true, type: 'boolean'},
|
'forcessl': {isRequired: false, default: true, type: 'boolean'},
|
||||||
'targetssl': {isRequired: false, default: false, type: 'boolean'},
|
'targetssl': {isRequired: false, default: false, type: 'boolean'},
|
||||||
}
|
}
|
||||||
|
@ -21,4 +21,5 @@ module.exports = {
|
|||||||
HSET: promisify(_client.HSET).bind(_client),
|
HSET: promisify(_client.HSET).bind(_client),
|
||||||
HGETALL: promisify(_client.HGETALL).bind(_client),
|
HGETALL: promisify(_client.HGETALL).bind(_client),
|
||||||
SMEMBERS: promisify(_client.SMEMBERS).bind(_client),
|
SMEMBERS: promisify(_client.SMEMBERS).bind(_client),
|
||||||
|
RENAME: promisify(_client.RENAME).bind(_client),
|
||||||
};
|
};
|
||||||
|
@ -73,7 +73,7 @@
|
|||||||
|
|
||||||
if($form.attr('isValid') === 'true'){
|
if($form.attr('isValid') === 'true'){
|
||||||
var formdata = $form.serializeObject();
|
var formdata = $form.serializeObject();
|
||||||
if(formdata.targetport) formdata.targetport = Number(formdata.targetport);
|
if(formdata.targetPort) formdata.targetPort = Number(formdata.targetPort);
|
||||||
if(formdata.targetssl) formdata.targetssl = formdata.targetssl == 'true' ? true : false;
|
if(formdata.targetssl) formdata.targetssl = formdata.targetssl == 'true' ? true : false;
|
||||||
if(formdata.forcessl) formdata.forcessl = formdata.forcessl == 'true' ? true : false;
|
if(formdata.forcessl) formdata.forcessl = formdata.forcessl == 'true' ? true : false;
|
||||||
|
|
||||||
@ -159,7 +159,7 @@
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label">Target TCP Port</label>
|
<label class="control-label">Target TCP Port</label>
|
||||||
<input type="number" name="targetport" class="form-control" value="80" min="0" max="65535" />
|
<input type="number" name="targetPort" class="form-control" value="80" min="0" max="65535" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user