hapi-ts-cli
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -6,2 +6,8 @@ export declare const APP_CONSTANT: { | ||
}; | ||
export declare const FILE_EXT: { | ||
TS: string; | ||
TMPL: string; | ||
}; | ||
export declare const API_TYPE: any; | ||
export declare const PROJECT_DIR: any; | ||
export declare const TEMPLATE_DIR: any; |
@@ -8,2 +8,6 @@ "use strict"; | ||
}; | ||
exports.FILE_EXT = { | ||
TS: ".ts", | ||
TMPL: ".tmpl" | ||
}; | ||
exports.API_TYPE = { | ||
@@ -15,1 +19,14 @@ POST: "create", | ||
}; | ||
exports.PROJECT_DIR = { | ||
APP: "app", | ||
MODULE: "module", | ||
HELPER: "helper", | ||
TEST: "test", | ||
}; | ||
exports.TEMPLATE_DIR = { | ||
NAME: "template", | ||
ROOT: "root", | ||
APP: "app", | ||
HELPER: "helpers", | ||
MODULE: "module" | ||
}; |
{ | ||
"name": "hapi-ts-cli", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Hapi Typescript scaffold project ", | ||
@@ -9,6 +9,7 @@ "repository": { | ||
}, | ||
"main": "build/index.js", | ||
"main": "build/cli.js", | ||
"bin": "build/index.js", | ||
"types": "build/index.d.ts", | ||
"scripts": { | ||
"start": "node build/cli.js", | ||
"prepublish": "npm run build", | ||
@@ -42,5 +43,11 @@ "build": "tsc", | ||
"dependencies": { | ||
"@types/fs-extra": "^4.0.5", | ||
"@types/joi": "^10.4.3", | ||
"@types/node": "^8.0.31" | ||
"@types/node": "^8.0.31", | ||
"@types/underscore": "^1.8.5", | ||
"@types/underscore.string": "0.0.32", | ||
"fs-extra": "^4.0.3", | ||
"underscore": "^1.8.3", | ||
"underscore.string": "^3.3.4" | ||
} | ||
} |
"use strict"; | ||
import * as odb from "oracledb"; | ||
const DEPLOY_MODE: string = process.env.DEPLOY_MODE; | ||
const PORT: number = Number(process.env.PHOTO_ID_PORT); | ||
const DB_CONN_URL: string = process.env.PHOTO_ID_DB; | ||
const DB_USER: string = process.env.PHOTO_ID_DB_USER; | ||
const DB_PASS: string = process.env.PHOTO_ID_DB_PASS; | ||
const REDIS_HOST: string = process.env.REDIS_HOST; | ||
const REDIS_PORT: string = process.env.REDIS_PORT; | ||
const REDIS_CLUSTER: boolean = (process.env.REDIS_CLUSTER==='true')? true: false; | ||
const LOCATION_HOST: string = process.env.LOCATION_HOST || ""; | ||
const FORTRESS_URL: string = process.env.FORTRESS_URL || ""; | ||
const APP_LOG_PATH: string = process.env.APP_LOG_PATH || ""; | ||
odb.autoCommit = true; | ||
const LOAD_CONFIG: Object = { | ||
@@ -25,38 +14,12 @@ "maxHeapUsedBytes": 1073741824, | ||
const APP_CONFIG = { | ||
"BASE_ROUTE_PREFIX" : "/2.1/credential-management", | ||
"LOG_PATH" : APP_LOG_PATH, | ||
"LOG_FILE_NAME" : "application", | ||
"LOG_LEVEL" : "debug", | ||
"FORTRESS_URL" : FORTRESS_URL, | ||
"LOCATION_HOST_STR" : LOCATION_HOST | ||
}; | ||
const REDIS_PARAMS : object = { | ||
"host": REDIS_HOST, | ||
"port": REDIS_PORT, | ||
"prefix": "MA", | ||
"cluster": REDIS_CLUSTER | ||
}; | ||
const DB_CONFIG: object = { | ||
"user": DB_USER, | ||
"password": DB_PASS, | ||
"connectString": DB_CONN_URL, | ||
"pool": true, | ||
"options": { | ||
"poolName": "HID_MS_API_POOL", | ||
"maxRows": 15000, | ||
"autoCommit": true, | ||
"poolMax": 2, | ||
"poolMin": 0 | ||
} | ||
}; | ||
export const config = { | ||
DEPLOY_MODE: DEPLOY_MODE, | ||
PORT: PORT, | ||
DB_CONFIG: DB_CONFIG, | ||
LOAD_CONFIG: LOAD_CONFIG, | ||
APP_CONFIG: APP_CONFIG, | ||
REDIS_CONFIG: REDIS_PARAMS, | ||
APP_LOG_PATH: APP_LOG_PATH | ||
@@ -63,0 +26,0 @@ }; |
@@ -6,4 +6,87 @@ "use strict"; | ||
import {config} from "./config"; | ||
import * as oracledb from "oracledb"; | ||
import {Route} from "./route"; | ||
let plugin: any = [ | ||
{ | ||
plugin: { | ||
register: "good", | ||
options: { | ||
includes: { | ||
request: ['payload', 'headers'], | ||
response: [] | ||
}, | ||
ops: { | ||
interval: 50000 | ||
}, | ||
wreck: true, | ||
reporters: { | ||
logReporter: [{ | ||
module: 'good-squeeze', | ||
name: 'Squeeze', | ||
args: [{ | ||
"response": "*" | ||
}] | ||
}, { | ||
module: 'good-squeeze', | ||
name: 'SafeJson' | ||
}, { | ||
module: 'rotating-file-stream', | ||
args: [ | ||
'audit.log', | ||
{ | ||
size: '50M', | ||
path: config.APP_LOG_PATH | ||
} | ||
] | ||
}], | ||
opsReporter: [{ | ||
module: 'good-squeeze', | ||
name: 'Squeeze', | ||
args: [{ | ||
ops: '*' | ||
}] | ||
}, { | ||
module: 'good-squeeze', | ||
name: 'SafeJson' | ||
}, { | ||
module: 'rotating-file-stream', | ||
args: [ | ||
'operational.log', | ||
{ | ||
size: '50M', | ||
path: config.APP_LOG_PATH | ||
} | ||
] | ||
}], | ||
errorReporter: [{ | ||
module: 'good-squeeze', | ||
name: 'Squeeze', | ||
args: [{ | ||
"log": "*" | ||
}] | ||
}, { | ||
module: 'good-squeeze', | ||
name: 'SafeJson', | ||
args: [{ | ||
error: '*' | ||
}] | ||
}, { | ||
module: 'rotating-file-stream', | ||
args: [ | ||
'error.log', | ||
{ | ||
size: '50M', | ||
interval: "1d", | ||
path: config.APP_LOG_PATH | ||
} | ||
] | ||
}] | ||
} | ||
} | ||
} | ||
} | ||
]; | ||
plugin.concat(Route); | ||
const manifest = { | ||
@@ -20,94 +103,3 @@ server: { | ||
}], | ||
registrations: [ | ||
{routePlugin}, | ||
{ | ||
plugin: { | ||
register: "hapi-api-version-support", | ||
options: { | ||
pattern: /^(application\/vnd.assaabloy.ma.credential-management-)(.*?)(\+json|\+jpg|\+png|\+jpeg)/, | ||
header: "content-type", | ||
supported_versions: ["2.1"], | ||
default_version: "2.1" | ||
} | ||
} | ||
}, | ||
{ | ||
plugin: { | ||
register: "good", | ||
options: { | ||
includes: { | ||
request: ['payload', 'headers'], | ||
response: [] | ||
}, | ||
ops: { | ||
interval: 50000 | ||
}, | ||
wreck: true, | ||
reporters: { | ||
logReporter: [{ | ||
module: 'good-squeeze', | ||
name: 'Squeeze', | ||
args: [{ | ||
"response": "*" | ||
}] | ||
}, { | ||
module: 'good-squeeze', | ||
name: 'SafeJson' | ||
}, { | ||
module: 'rotating-file-stream', | ||
args: [ | ||
'audit.log', | ||
{ | ||
size: '50M', | ||
path: config.APP_LOG_PATH | ||
} | ||
] | ||
}], | ||
opsReporter: [{ | ||
module: 'good-squeeze', | ||
name: 'Squeeze', | ||
args: [{ | ||
ops: '*' | ||
}] | ||
}, { | ||
module: 'good-squeeze', | ||
name: 'SafeJson' | ||
}, { | ||
module: 'rotating-file-stream', | ||
args: [ | ||
'operational.log', | ||
{ | ||
size: '50M', | ||
path: config.APP_LOG_PATH | ||
} | ||
] | ||
}], | ||
errorReporter: [{ | ||
module: 'good-squeeze', | ||
name: 'Squeeze', | ||
args: [{ | ||
"log": "*" | ||
}] | ||
}, { | ||
module: 'good-squeeze', | ||
name: 'SafeJson', | ||
args: [{ | ||
error: '*' | ||
}] | ||
}, { | ||
module: 'rotating-file-stream', | ||
args: [ | ||
'error.log', | ||
{ | ||
size: '50M', | ||
interval: "1d", | ||
path: config.APP_LOG_PATH | ||
} | ||
] | ||
}] | ||
} | ||
} | ||
} | ||
} | ||
] | ||
registrations: plugin | ||
}; | ||
@@ -119,16 +111,4 @@ | ||
function initDataBase() { | ||
oracledb.createPool( | ||
config.DB_CONFIG, | ||
(err, pool) => { | ||
if (err) { | ||
console.log("DB Error", err); | ||
} else { | ||
console.log("Connected Successfully"); | ||
} | ||
}); | ||
} | ||
Glue.compose(manifest, composeOptions, (err, server) => { | ||
server.start((serverStartError) => { | ||
initDataBase(); | ||
//console.info('Server running at: ' + server.info.uri); | ||
@@ -140,3 +120,2 @@ if (serverStartError) { | ||
}); | ||
}); | ||
}); |
@@ -18,11 +18,4 @@ const gulp = require('gulp'); | ||
"PHOTO_ID_PORT": "3044", | ||
"PHOTO_ID_DB": "sispndev.ceef5xp9pycn.us-east-1.rds.amazonaws.com/sispndev", | ||
"PHOTO_ID_DB_USER": "msportal", | ||
"PHOTO_ID_DB_PASS": "sec4cld", | ||
"REDIS_HOST": "sispdevec.je6eii.0001.use1.cache.amazonaws.com", | ||
"REDIS_PORT": "6379", | ||
"REDIS_CLUSTER": false, | ||
"LOCATION_HOST": "https://sis7-dev-1030801734.us-east-1.elb.amazonaws.com", | ||
"FORTRESS_URL": "https://ussltsida01t:8002/ac.4tress.samlidp/SISDOMAIN/authn/userinfo", | ||
"APP_LOG_PATH": "/var/opt/hid/logs/photo-id-service" | ||
"LOCATION_HOST": "", | ||
"APP_LOG_PATH": "/var/opt/logs/" | ||
} | ||
@@ -29,0 +22,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41564
31
910
8
2
+ Added@types/fs-extra@^4.0.5
+ Added@types/underscore@^1.8.5
+ Addedfs-extra@^4.0.3
+ Addedunderscore@^1.8.3
+ Addedunderscore.string@^3.3.4
+ Added@types/fs-extra@4.0.15(transitive)
+ Added@types/underscore@1.13.0(transitive)
+ Added@types/underscore.string@0.0.32(transitive)
+ Addedfs-extra@4.0.3(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedjsonfile@4.0.0(transitive)
+ Addedsprintf-js@1.1.3(transitive)
+ Addedunderscore@1.13.7(transitive)
+ Addedunderscore.string@3.3.6(transitive)
+ Addeduniversalify@0.1.2(transitive)
+ Addedutil-deprecate@1.0.2(transitive)