forked from ElementsProject/nanotip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nanotipd
executable file
·34 lines (27 loc) · 1.72 KB
/
nanotipd
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
#!/usr/bin/env node
const args = require('meow')(`
Usage
$ nanotipd [options]
Options
-c, --charge-url <url> lightning charge server url [default: http://localhost:9112]
-t, --charge-token <token> lightning charge access token [required]
-P, --charge-public-url <url> url where charge is publicly accessible [default: {charge-url}]
-m, --theme <name> pick theme from bootswatch.com [default: yeti]
-l, --title <name> website title [default: Lightning Tip Box]
-p, --port <port> http server port [default: 9115]
-i, --host <host> http server listen address [default: 127.0.0.1]
-u, --url <url> http server public url (used for webhooks) [default: http://{host}:{port}]
-T, --thankyou-url <url> url to send users to after completing the payment [default: {url}/thankyou]
-e, --node-env <env> nodejs environment mode [default: production]
-h, --help output usage information
-v, --version output version number
Example
$ nanotipd -c http://localhost:9112 -t chargeSecretToken
`, { flags: { chargeUrl: {alias:'c', default: 'http://localhost:9112'}, chargeToken: {alias:'t'}, chargePublicUrl: {alias:'P'}
, theme: {alias:'m'}, title: {alias:'l'}, url: {alias:'u'}, thankyouUrl: {alias:'T'}
, port: {alias:'p'}, host: {alias:'i'}, nodeEnv: {alias:'e', default:'production'} } }
).flags
Object.keys(args).filter(k => k.length > 1)
.forEach(k => process.env[k.replace(/([A-Z])/g, '_$1').toUpperCase()] = args[k])
process.env.CHARGE_TOKEN || (console.error('--charge-token is required'), process.exit(1))
require('./nanotip')