vagrant update
This commit is contained in:
Vendored
+9
-6
@@ -34,7 +34,7 @@ Vagrant.configure("2") do |config|
|
|||||||
|
|
||||||
# Every Vagrant development environment requires a box. You can search for
|
# Every Vagrant development environment requires a box. You can search for
|
||||||
# boxes at https://vagrantcloud.com/search.
|
# boxes at https://vagrantcloud.com/search.
|
||||||
config.vm.box = "ubuntu/bionic64"
|
config.vm.box = "ubuntu/jammy64"
|
||||||
config.vm.synced_folder '.', '/vagrant' # The vagrant dir just stopped automounting
|
config.vm.synced_folder '.', '/vagrant' # The vagrant dir just stopped automounting
|
||||||
|
|
||||||
# Create a forwarded port mapping which allows access to a specific port
|
# Create a forwarded port mapping which allows access to a specific port
|
||||||
@@ -66,9 +66,11 @@ Vagrant.configure("2") do |config|
|
|||||||
# documentation for more information about their specific syntax and use.
|
# documentation for more information about their specific syntax and use.
|
||||||
config.vm.provision "shell", inline: <<~SHELL
|
config.vm.provision "shell", inline: <<~SHELL
|
||||||
apt-get update
|
apt-get update
|
||||||
if ! apt list ruby2.6-dev | grep installed; then
|
if ! apt list ruby-dev | grep installed; then
|
||||||
apt-add-repository ppa:brightbox/ruby-ng -y
|
# apt-add-repository ppa:brightbox/ruby-ng -y
|
||||||
sudo apt-get install -y build-essential resolvconf ruby2.6 ruby2.6-dev gem
|
sudo apt-get install -y build-essential resolvconf ruby-full gem
|
||||||
|
gem install chef -v 17.10.0
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! which berks >/dev/null; then
|
if ! which berks >/dev/null; then
|
||||||
@@ -90,7 +92,8 @@ Vagrant.configure("2") do |config|
|
|||||||
SHELL
|
SHELL
|
||||||
|
|
||||||
config.vm.provision 'chef_solo' do |chef|
|
config.vm.provision 'chef_solo' do |chef|
|
||||||
chef.version = '14.12.3' # version 14.12.9 fails to run
|
chef.arguments = "--chef-license accept"
|
||||||
|
# chef.version = '15.7.31' # version 14.12.9 fails to run
|
||||||
chef.cookbooks_path = [
|
chef.cookbooks_path = [
|
||||||
'ops/cookbooks/',
|
'ops/cookbooks/',
|
||||||
'ops/cookbooks/vendor/'
|
'ops/cookbooks/vendor/'
|
||||||
@@ -111,7 +114,7 @@ Vagrant.configure("2") do |config|
|
|||||||
'nodejs': {
|
'nodejs': {
|
||||||
'working-dir': 'nodejs',
|
'working-dir': 'nodejs',
|
||||||
'port': '3000',
|
'port': '3000',
|
||||||
'install_version': 13,
|
'install_version': 18,
|
||||||
'exec_file': 'bin/www',
|
'exec_file': 'bin/www',
|
||||||
'service': true,
|
'service': true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ User.add = async function(data) {
|
|||||||
data['backing'] = data['backing'] || 'redis';
|
data['backing'] = data['backing'] || 'redis';
|
||||||
|
|
||||||
|
|
||||||
|
console.log('set password', data)
|
||||||
|
|
||||||
return this.__proto__.add(data);
|
return this.__proto__.add(data);
|
||||||
|
|
||||||
}catch(error){
|
}catch(error){
|
||||||
@@ -104,17 +106,18 @@ module.exports = {User};
|
|||||||
|
|
||||||
|
|
||||||
(async function(){
|
(async function(){
|
||||||
|
var defaultUser = 'proxyadmin2'
|
||||||
try{
|
try{
|
||||||
await User.get('proxyadmin1');
|
let user = await User.get(defaultUser);
|
||||||
console.info('proxyadmin1 user exists');
|
|
||||||
}catch(error){
|
}catch(error){
|
||||||
try{
|
try{
|
||||||
let user = await User.add({
|
let user = await User.add({
|
||||||
username:'proxyadmin1',
|
username:defaultUser,
|
||||||
password: 'proxyadmin1',
|
password: defaultUser,
|
||||||
created_by:'proxyadmin1'
|
created_by:defaultUser
|
||||||
});
|
});
|
||||||
console.log('proxyadmin1 created', user);
|
console.log(defaultUser, 'created', user);
|
||||||
}catch(error){
|
}catch(error){
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+622
-591
File diff suppressed because it is too large
Load Diff
+2
-3
@@ -12,14 +12,13 @@
|
|||||||
"start": "node ./bin/www"
|
"start": "node ./bin/www"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"authenticate-pam": "github:WeiAnAn/node-authenticate-pam",
|
|
||||||
"bcrypt": "^5.0.0",
|
"bcrypt": "^5.0.0",
|
||||||
"ejs": "^3.0.1",
|
"ejs": "^3.0.1",
|
||||||
"express": "~4.16.1",
|
"express": "^4.18.2",
|
||||||
"extend": "^3.0.2",
|
"extend": "^3.0.2",
|
||||||
"ldapts": "^2.2.1",
|
"ldapts": "^2.2.1",
|
||||||
"linux-sys-user": "^1.1.0",
|
"linux-sys-user": "^1.1.0",
|
||||||
"redis": "^2.8.0"
|
"redis": "^4.6.5"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
+12
-14
@@ -5,21 +5,19 @@ const config = {
|
|||||||
prefix: 'proxy_'
|
prefix: 'proxy_'
|
||||||
}
|
}
|
||||||
|
|
||||||
function client() {
|
var _client = createClient(config);
|
||||||
return createClient(config);
|
_client.connect()
|
||||||
}
|
|
||||||
|
|
||||||
const _client = client();
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
client: client,
|
client: _client,
|
||||||
HGET: promisify(_client.HGET).bind(_client),
|
// HGET: promisify(_client.HGET).bind(_client),
|
||||||
HDEL: promisify(_client.HDEL).bind(_client),
|
// HDEL: promisify(_client.HDEL).bind(_client),
|
||||||
SADD: promisify(_client.SADD).bind(_client),
|
// SADD: promisify(_client.SADD).bind(_client),
|
||||||
SREM: promisify(_client.SREM).bind(_client),
|
// SREM: promisify(_client.SREM).bind(_client),
|
||||||
DEL: promisify(_client.DEL).bind(_client),
|
// DEL: promisify(_client.DEL).bind(_client),
|
||||||
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),
|
// RENAME: promisify(_client.RENAME).bind(_client),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const client = require('../utils/redis');
|
const {createClient} = require('redis');
|
||||||
const objValidate = require('../utils/object_validate');
|
const objValidate = require('../utils/object_validate');
|
||||||
|
|
||||||
|
var client = createClient({});
|
||||||
|
client.connect()
|
||||||
|
|
||||||
|
|
||||||
let table = {};
|
let table = {};
|
||||||
|
|
||||||
@@ -20,7 +23,7 @@ table.get = async function(data){
|
|||||||
let res = await client.HGETALL(`${this._name}_${data[this._key]}`);
|
let res = await client.HGETALL(`${this._name}_${data[this._key]}`);
|
||||||
|
|
||||||
// If the redis query resolved to something, prepare the data.
|
// If the redis query resolved to something, prepare the data.
|
||||||
if(res){
|
if(Object.keys(res).length){
|
||||||
|
|
||||||
// Redis always returns strings, use the keyMap schema to turn them
|
// Redis always returns strings, use the keyMap schema to turn them
|
||||||
// back to native values.
|
// back to native values.
|
||||||
@@ -106,12 +109,13 @@ table.add = async function(data, noMemberAdd){
|
|||||||
|
|
||||||
// Add the values for this entry.
|
// Add the values for this entry.
|
||||||
for(let key of Object.keys(data)){
|
for(let key of Object.keys(data)){
|
||||||
await client.HSET(`${this._name}_${data[this._key]}`, key, data[key]);
|
await client.hSet(`${this._name}_${data[this._key]}`, key, String(data[key]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// return the created redis entry as entry instance.
|
// return the created redis entry as entry instance.
|
||||||
return await this.get(data[this._key]);
|
return await this.get(data[this._key]);
|
||||||
} catch(error){
|
} catch(error){
|
||||||
|
console.error('redis model | table.add:', error)
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -168,7 +168,7 @@
|
|||||||
<div class="radio">
|
<div class="radio">
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" name="targetssl" id="targetssl-true" value="true">
|
<input type="radio" name="targetssl" id="targetssl-true" value="true">
|
||||||
Proxt to HTTPS
|
Proxy to HTTPS
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="radio">
|
<div class="radio">
|
||||||
|
|||||||
Reference in New Issue
Block a user