oooxxxoooxxx: vpc Connector name
aaabbbaaabbb: your firebase project
Firebase deploy default vpcConnector vpc-Connector
node_modules\firebase-tools\lib\gcp\cloudfunctions.js
_createFunction
const data ADD
vpcConnector: ‘oooxxxoooxxx’,
Failed gcloud VPC
VPC_CONNECTOR=dosportsapi-redis01
projects/aaabbbaaabbb/locations/us-central1/connectors/oooxxxoooxxx
gcloud beta functions deploy api \
--runtime nodejs10 \
--trigger-http \
--region us-central1 \
--vpc-connector $VPC_CONNECTOR \
--egress-settings private-ranges-only \
--memory 2048MB
https://www.luoow.com/dc_tw/104458719
https://www.datayang.com/article/78
https://stackoverflow.com/questions/784929/what-is-the-not-not-operator-in-javascript
https://stackoverflow.com/questions/29312123/how-does-the-double-exclamation-work-in-javascript
value
!value
!!value
false
true
false true
false true
null
true false undefined
true false 0
true false -0
true false 1
false
true -5
false true NaN
true false ''
true false ‘hello’
true false
1. aws https://www.fortinet.com/content/dam/fortinet/assets/solutions/aws/FortiGate-AWS-Engineering-Reference-Document-Q4-2015.pdf 2. https://geekdudes.wordpress.com/2018/07/18/install-fortigate-amazon-ec2-instance/ 3. https://geekdudes.wordpress.com/2018/08/19/creating-static-route-in-aws-ec2-fortigate-instance/ Many documents forget SG(security group) 1. FortiGate VM SG need Inbound rules:
All traffic All All 10.0.0.0/16
2. Private VM SG need Inbound rules:
All traffic All All 10.0.0.0/16
Setting finish.
First fortigate cmd:
execute ping Private VM private ip. Need success.
Second in private vm cmd:
ping FortiGate Lan ip. Need success. Don’t forgate Check “Ping” option.
ping 10.0.1.1. Need success.
Now ping 8.
http://liu-xin.me/2017/03/24/%E8%AE%A9%E5%86%99%E5%85%A5%E6%95%B0%E6%8D%AE%E5%BA%93%E7%9A%84%E6%95%B0%E6%8D%AE%E8%87%AA%E5%8A%A8%E5%86%99%E5%85%A5%E7%BC%93%E5%AD%98/```
const to = require(‘await-to-js’).default;
const Redis = require(‘ioredis’);
const redis = new Redis(ooxxooxx);
function Cache() {}
Cache.get = async function(key) {
const [err, res] = await to(redis.get(key));
if (err) {console.error(‘REDIS::Cache::get]’, err); return null;}
return JSON.parse(res);
};
Cache.set = async function(key, value) {
value = JSON.stringify(value);
const [err] = await to(redis.set(key, value));
if (err) {console.error(‘REDIS::Cache::set]’, err); }
};
//
// sequelize.query
//
async function CacheSequelizeQuery(sequelize, sql, params, redisKey) {
const cacheData = await Cache.
https://github.com/luin/ioredis```
const Redis = require(‘ioredis’);
const redis = new Redis();
const delScript = local all_keys = {}; local keys = {}; local done = false; local cursor = "0" repeat local result = redis.call("SCAN", cursor, "match", KEYS[1], "count", KEYS[2]) cursor = result[1]; keys = result[2]; for i, key in ipairs(keys) do all_keys[#all_keys+1] = key; end if cursor == "0" then done = true; end until done for i, key in ipairs(all_keys) do redis.