This repository has been archived by the owner on Jul 30, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathodt.js
113 lines (93 loc) · 3.88 KB
/
odt.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
var program = require("commander");
var version = require("./package.json").version;
var _ = require("lodash");
var path = require("path");
program
.version(version)
.option('-i, --instances [instance number]', 'Number of handler instances. Default: Number of CPU cores', parseInt)
.option('-p, --port [port]', 'Handler port. Default: 5000', parseInt)
.option('-w, --queue-port [interface port]', 'Queue interface port. Set to false to disable interface. Default: 4900')
.option('-c, --config <config file>', 'Specify a config file to load')
.option('--original-storage-type <type>', 'Select original storage type.')
.option('--original-storage-source-path <source>', 'Set original storage source path')
.option('--original-storage-container <container>', 'Set original storage container name')
.option('--original-storage-username <username>', 'Set original storage username')
.option('--original-storage-password <password>', 'Set original storage password')
.option('--original-storage-url <url>', 'Set original storage url')
.option('--thumbnail-storage-type [type]', 'Select thumbnail storage type.')
.option('--thumbnail-storage-source-path [source]', 'Set thumbnail storage source path')
.option('--thumbnail-storage-container <container>', 'Set thumbnail storage container name')
.option('--thumbnail-storage-username <username>', 'Set thumbnail storage username')
.option('--thumbnail-storage-password <password>', 'Set thumbnail storage password')
.option('--thumbnail-storage-url <url>', 'Set thumbnail storage url')
.option('--statsd-host <host>', 'Set statsd host')
.option('--statsd-port <port>', 'Set statsd port. Default 8125')
.option('--statsd-prefix <prefix>', 'Set statsd prefix.')
.option('--redis-host <host>', 'Set redis host. Default: localhost')
.option('--redis-port <port>', 'Set redis port. Default: 6379')
.option('--redis-auth <auth>', 'Set redis authentication password')
.option('--secret <secret>', 'Set a secret used for token generation')
.option('--enable-token-only', 'Enable token only access')
.parse(process.argv);
if (program.config) {
program.config = path.resolve(program.config);
config = require(program.config);
_.extend(program, config);
}
var options = {
instances: program.instances,
handlerPort: program.port,
queuePort: program.queuePort,
statsdHost: program.statsdHost,
statsdPort: program.statsdPort,
statsdPrefix: program.statsdPrefix,
redisHost: program.redisHost,
redisPort: program.redisPort,
redisAuth: program.redisAuth,
storage: {},
enableTokenOnly: program.enableTokenOnly || false,
secret: program.secret || ""
};
if (program.originalStorageType === 'local') {
options.storage.original = {
type: 'local',
sourcePath: program.originalStorageSourcePath
};
options.storage.thumbnail = {
type: 'local',
sourcePath: program.originalStorageSourcePath
};
}
if (program.originalStorageType === 'swift') {
options.storage.original = {
type: 'swift',
container: program.originalStorageContainer,
username: program.originalStorageUsername,
password: program.originalStoragePassword,
url: program.originalStorageUrl
};
options.storage.thumbnail = {
type: 'swift',
container: program.originalStorageContainer,
username: program.originalStorageUsername,
password: program.originalStoragePassword,
url: program.originalStorageUrl
};
}
if (program.thumbnailStorageType === 'local') {
options.storage.thumbnail = {
type: 'local',
sourcePath: program.thumbnailStorageSourcePath
};
}
if (program.thumbnailStorageType === 'swift') {
options.storage.thumbnail = {
type: 'swift',
container: program.thumbnailStorageContainer,
username: program.thumbnailStorageUsername,
password: program.thumbnailStoragePassword,
url: program.thumbnailStorageUrl
};
}
require("coffee-script/register");
require("./app/server")(options);