-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmedia01.ts
More file actions
57 lines (36 loc) · 1009 Bytes
/
media01.ts
File metadata and controls
57 lines (36 loc) · 1009 Bytes
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
47
48
import * as dotenv from 'dotenv'
const ip = require('ip')
import MediaServer from './medianode/server'
dotenv.config()
const yargs = require('yargs')
const localhost = ip.address()
const argv = yargs.usage(`Usage: ts-node $0 -p 6001 -h 127.0.0.1 -e {localhost}`)
.help('help').alias('help','-h')
.default({
endpoint:localhost,
host:'127.0.0.1',
port:6001
})
.options({
endpoint: {
alias: 'e',
description: 'endpoint, default 127.0.0.1'
},
host: {
alias: 'h',
description: 'host, default 127.0.0.1'
},
port: {
alias: 'p',
description: 'port, default 6001'
}
}).argv
const port = argv.port as number
const host = argv.host as string
let endpoint = localhost
const media01 = new MediaServer({
endpoint: endpoint
})
media01.start(port, host, () => {
console.log(`media server start on ${port} endpoint ${endpoint}`)
})