-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathindex.js
More file actions
56 lines (48 loc) · 1.19 KB
/
index.js
File metadata and controls
56 lines (48 loc) · 1.19 KB
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
/**
* Copyright 2015 Google Inc. All Rights Reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file or at
* https://github.com/firebase/superstatic/blob/master/LICENSE
*/
'use strict';
var nash = require('nash');
var fs = require('fs');
var path = require('path');
var PORT = 3474;
var HOSTNAME = 'localhost';
var CONFIG_FILENAME = ['superstatic.json', 'firebase.json'];
var ENV_FILENAME = '.env.json';
var DEBUG = false;
var LIVE = false;
var SYMLINK = false;
var env;
try {
env = JSON.parse(fs.readFileSync(path.resolve(ENV_FILENAME), 'utf8'));
} catch (e) {
// do nothing
}
module.exports = function() {
var cli = module.exports = nash();
// Defaults
cli.set('port', PORT);
cli.set('hostname', HOSTNAME);
cli.set('config', CONFIG_FILENAME);
cli.set('env', env);
cli.set('debug', DEBUG);
cli.set('live', LIVE);
cli.set('symlink', SYMLINK);
// If no commands matched, the user probably
// wants to run a server
cli.register([
{
register: require('./flags')
},
{
register: require('./server'),
options: {
server: require('../server')
}
}
], function() {});
return cli;
};