Commit 450f7354 authored by yPhil's avatar yPhil
Browse files

Alternate environment CLI args

parent e95abe11
......@@ -37,3 +37,4 @@ jspm_packages
# Misc
tmp
package-lock.json
cert
......@@ -3,10 +3,33 @@
var app = require('../app');
var debug = require('debug')('petrolette:server');
var http = require('http');
const fs = require('fs');
var port = normalizePort(process.env.PORT || '8000');
app.set('port', port);
function isLocal() {
switch( window.location.protocol ) {
case 'file:':
return true;
default:
return false;
}
}
var port = normalizePort(process.env.PORT || '8080');
app.set('port', port);
console.log('ENV: ' + process.env.NODE_ENV);
// if (!isLocal) {
// const options = {
// cert: fs.readFileSync('../cert/fullchain.pem'),
// key: fs.readFileSync('../cert/privkey.pem')
// };
// } else {
// const options
// }
// const options = isLocal() ? '' : {cert: fs.readFileSync('../cert/fullchain.pem'), key: fs.readFileSync('../cert/privkey.pem')};
var server = http.createServer(app);
......
......@@ -12,11 +12,12 @@
"url": "https://framagit.org/yphil/petrolette"
},
"scripts": {
"start": "pm2 start pm2.config.json",
"petrolette": "pm2 start pm2.config.json",
"petrolette-ssl": "pm2 start pm2.config.json --env ssl",
"restart": "pm2 restart pm2.config.json",
"stop": "pm2 stop ptl",
"show": "pm2 show ptl",
"logs": "pm2 logs ptl",
"stop": "pm2 stop petrolette",
"show": "pm2 show petrolette",
"log": "pm2 logs petrolette",
"postinstall": "bower install"
},
"dependencies": {
......
{
"apps" : [{
"name" : "ptl",
"script" : "./bin/www",
"watch" : true,
"ignore_watch" : ["#*", "favicons-cache", ".git", "node_modules"],
"log_date_format" : "YYYY-MM-DD HH:mm",
"env" : {
"PORT" : 8000,
"FAVICONS_CACHE_DIR": "favicons-cache"
},
"env_production" : {
"NODE_ENV": "production"
"apps" : [
{
"name" : "petrolette",
"script" : "./bin/www",
"watch" : true,
"ignore_watch" : ["#*", "favicons-cache", ".git", "node_modules"],
"log_date_format" : "YYYY-MM-DD HH:mm",
"env" : {
"PORT" : 8080,
"NODE_ENV": "dev",
"FAVICONS_CACHE_DIR": "favicons-cache"
},
"env_ssl" : {
"PORT" : 8080,
"NODE_ENV": "ssl",
"FAVICONS_CACHE_DIR": "favicons-cache"
}
}
}]
]
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment