From 3410d0f19d1c9e08ab9f2157bccded5b4f8ddafc Mon Sep 17 00:00:00 2001 From: VirtualWolf Date: Sun, 9 Aug 2020 14:51:15 +1000 Subject: [PATCH] Fall back to default 2314 port if settings.json doesn't exist and process.env.PORT doesn't exist. Fixes #31. --- brain/views/init.pug | 5 ++--- init.js | 9 +++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/brain/views/init.pug b/brain/views/init.pug index 9dd7189..ada7f90 100644 --- a/brain/views/init.pug +++ b/brain/views/init.pug @@ -1,5 +1,5 @@ extends frame -block main-content +block main-content #dash-index #dash-index-wrapper .dash-init#dash-init @@ -21,11 +21,10 @@ block main-content br label And let's confirm that password br - input.large(type='password', name='new_member_pass2' id='new_member_pass2', placeholder="Email Confirm") + input.large(type='password', name='new_member_pass2' id='new_member_pass2', placeholder="Password Confirm") br label And finally, a title br input.large(type='text', name='new_member_title' id='new_member_title', placeholder="Site Title Please") br button#init-blog(data-action='blog-init' type='submit') SET IT UP - diff --git a/init.js b/init.js index e040ec7..a1d6680 100644 --- a/init.js +++ b/init.js @@ -7,13 +7,18 @@ var app = require('./brain/app'); var debug = require('debug')('fipamo:server'); var http = require('http'); -var config = require('./site/settings.json'); /** * Get port from environment and store in Express. */ -var port = normalizePort(process.env.PORT || config.global.port); +try { + var configPort = require('./site/settings.json').global.port; +} catch (err) { + console.log('settings.json not found, assuming this is a first run...') +} + +var port = normalizePort(configPort || process.env.PORT || 2314); app.set('port', port); /**