-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentry.js
46 lines (43 loc) · 1.25 KB
/
entry.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const runNeoCmd = require("./neocmd.js")
const readline = require("readline")
if (
process.argv.length === 3 &&
process.argv[2].trim().toLowerCase() === "open"
) {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
})
rl.prompt()
rl.question("Input your password: ", pass => {
// TODO: Log the answer in a database
console.log(`Your password is: ${pass}`)
rl.close()
console.log("running open-db-tunnel ...")
runNeoCmd(
"open-db-tunnel",
"ap1.hana.ondemand.com",
"hanamobileprod",
"i063065",
pass,
"-i mobileservices.apptracelog --background --output json"
).then(res => {
res = JSON.parse(res)
console.log("result port=" + res.result.port)
console.log("result jdbcUrl=" + res.result.jdbcUrl)
console.log("result sessionId= " + res.result.sessionId)
})
console.log("after running open-db-tunnel ")
})
} else if (
process.argv.length === 4 &&
process.argv[2].trim().toLowerCase() === "close"
) {
console.log("running close-db-tunnel ...")
runNeoCmd("close-db-tunnel", "--session-id " + process.argv[3].trim()).then(
res => {
console.log("Close finished")
}
)
console.log("after running close-db-tunnel ...")
}