New dev commands and updates
This commit is contained in:
25
index.js
25
index.js
@ -1,7 +1,30 @@
|
||||
require('./init');
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
console.log(
|
||||
'\n\x1b[33m%s\x1b[0m',
|
||||
'Running Outline in production mode. Use `yarn dev` to run in development with live code reloading'
|
||||
);
|
||||
} else if (process.env.NODE_ENV === 'development') {
|
||||
console.log(
|
||||
'\n\x1b[33m%s\x1b[0m',
|
||||
'Running Outline in development mode with React hot reloading. To run Outline in production mode, use `yarn start`'
|
||||
);
|
||||
}
|
||||
|
||||
const app = require('./server').default;
|
||||
const http = require('http');
|
||||
|
||||
if (
|
||||
process.env.SECRET_KEY ===
|
||||
'F0E5AD933D7F6FD8F4DBB3E038C501C052DC0593C686D21ACB30AE205D2F634B'
|
||||
) {
|
||||
console.error(
|
||||
'Please set SECRET_KEY env variable with output of `openssl rand -hex 32`'
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const server = http.createServer(app.callback());
|
||||
server.listen(process.env.PORT || '3000');
|
||||
server.on('error', err => {
|
||||
@ -9,5 +32,5 @@ server.on('error', err => {
|
||||
});
|
||||
server.on('listening', () => {
|
||||
const address = server.address();
|
||||
console.log(`Listening on http://localhost:${address.port}`);
|
||||
console.log(`\n> Listening on http://localhost:${address.port}\n`);
|
||||
});
|
||||
|
Reference in New Issue
Block a user