Comparing version 1.0.4 to 1.0.5
@@ -1,2 +0,2 @@ | ||
declare const _default: { | ||
declare var ENV: { | ||
API_ROOT: string; | ||
@@ -24,4 +24,4 @@ API_ANNO: string; | ||
}; | ||
export default _default; | ||
export default ENV; | ||
export declare const isPro: boolean; | ||
export declare const PORT = 9000; |
@@ -28,18 +28,3 @@ "use strict"; | ||
const _ = __importStar(require("lodash")); | ||
const os_1 = require("os"); | ||
let networks = (0, os_1.networkInterfaces)(); | ||
let DEF_SERVER = '192.168.119.97'; | ||
var redis_pass = ''; | ||
for (let key in networks) { | ||
if (_.find(networks[key], { mac: '08:1f:71:2e:c1:69' })) { | ||
DEF_SERVER = '10.10.10.10'; | ||
break; | ||
} | ||
if (_.find(networks[key], { mac: 'd4:93:90:13:cb:b7' })) { | ||
DEF_SERVER = '192.168.119.97'; | ||
redis_pass = 'vrv@123'; | ||
break; | ||
} | ||
} | ||
exports.default = { | ||
var ENV = { | ||
API_ROOT: process.env.API_ROOT || '', | ||
@@ -50,6 +35,6 @@ API_ANNO: process.env.API_ANNO || '', | ||
TENCENT_REGION: process.env.TENCENT_REGION || 'ap-guangzhou', | ||
REDIS_HOST: process.env.REDIS_HOST || DEF_SERVER, | ||
REDIS_HOST: process.env.REDIS_HOST || '', | ||
REDIS_PORT: process.env.REDIS_PORT ? parseInt(process.env.REDIS_PORT) : 6379, | ||
REDIS_PASS: process.env.REDIS_PASS || redis_pass, | ||
PG_HOST: process.env.PG_HOST || DEF_SERVER, | ||
REDIS_PASS: process.env.REDIS_PASS || '', | ||
PG_HOST: process.env.PG_HOST || '', | ||
PG_PORT: process.env.PG_PORT ? parseInt(process.env.PG_PORT) : 5432, | ||
@@ -73,3 +58,4 @@ PG_USER: process.env.PG_USER || 'postgres', | ||
}; | ||
exports.default = ENV; | ||
exports.isPro = (process.env.SERVERLESS) ? true : false; | ||
exports.PORT = 9000; |
@@ -41,3 +41,3 @@ "use strict"; | ||
const env_1 = __importDefault(require("./env")); | ||
const postgres_1 = __importDefault(require("@fastify/postgres")); | ||
const fasfity_pg_1 = __importDefault(require("oor/plugins/fasfity-pg")); | ||
const redis_1 = __importDefault(require("@fastify/redis")); | ||
@@ -49,3 +49,2 @@ const global_1 = require("../global"); | ||
Object.defineProperty(exports, "fastify", { enumerable: true, get: function () { return _Application_1.fastify; } }); | ||
const orm_1 = require("../orm"); | ||
const ERROR_USER_NOT_LOGIN = new global_1.VError(global_1.GLOBAL_ERROR._USER_NOT_LOGIN); | ||
@@ -59,11 +58,8 @@ // class SQLError extends Error { | ||
if (!_.has(options, 'usePg') || options.usePg !== false) { | ||
_Application_1.fastify.register(postgres_1.default, { | ||
host: env_1.default.PG_HOST, port: env_1.default.PG_PORT, user: env_1.default.PG_USER, password: env_1.default.PG_PASS, database: env_1.default.PG_DB, | ||
// min: 1, max: 10 | ||
_Application_1.fastify.register(fasfity_pg_1.default, { | ||
provider: { | ||
host: env_1.default.PG_HOST, port: env_1.default.PG_PORT, user: env_1.default.PG_USER, password: env_1.default.PG_PASS, database: env_1.default.PG_DB, | ||
// min: 1, max: 10 | ||
}, pageSize: 15, | ||
}); | ||
(0, orm_1.setup)({ | ||
provider: () => _Application_1.fastify.pg, | ||
pageSize: 15, | ||
// err: SQLError | ||
}); | ||
} | ||
@@ -70,0 +66,0 @@ // REDIS PLUGIN |
@@ -1,6 +0,1 @@ | ||
{ | ||
"name": "eha", | ||
"version": "1.0.4", | ||
"description": "Eha For ServerLess", | ||
"author": "ada87" | ||
} | ||
{"name":"eha","version":"1.0.5","description":"Eha For ServerLess","author":"ada87"} |
55187
39
1354