Compare commits

...

2 Commits

8 changed files with 42 additions and 17 deletions

View File

@ -5,14 +5,16 @@ SITE_NAME="(dev) No Moss 3 Carbo Landfill Online Localhost"
# SITE_HOST is used for generating links for the search index. (If you leave this blank it should work using relative paths.) # SITE_HOST is used for generating links for the search index. (If you leave this blank it should work using relative paths.)
SITE_HOST="localhost" SITE_HOST="localhost"
# SITE_URL is used for generating links for the search index. (If you leave this blank it should work using relative paths.) # SITE_URL is used for generating links for the search index. (If you leave this blank it should work using relative paths.)
SITE_URL="https://$SITE_HOST" SITE_URL="https://${SITE_HOST}"
# WELCOME_MSG is used for the homepage instead of "Welcome to ${SITE_NAME}!"
WELCOME_MSG="Devel' It Up, Developer!"
# APP_HTTP_LISTEN_PORT is the TCP port used to access the Node application's HTTP interface (usually by a reverse proxy). # APP_HTTP_LISTEN_PORT is the TCP port used to access the Node application's HTTP interface (usually by a reverse proxy).
APP_HTTP_HOST="nm3clol" APP_HTTP_HOST="nm3clol"
# APP_HTTP_LISTEN_PORT is the TCP port used to access the Node application's HTTP interface (usually by a reverse proxy). # APP_HTTP_LISTEN_PORT is the TCP port used to access the Node application's HTTP interface (usually by a reverse proxy).
APP_HTTP_LISTEN_PORT=3000 APP_HTTP_LISTEN_PORT=3000
# APP_URL is the URL used to access the Node application (usually by a reverse proxy). # APP_URL is the URL used to access the Node application (usually by a reverse proxy).
APP_HTTP_URL="http://$APP_HTTP_HOST:$APP_HTTP_LISTEN_PORT" APP_HTTP_URL="http://${APP_HTTP_HOST}:${APP_HTTP_LISTEN_PORT}"
# SOLR_DOCS_HOST is the host for Apache Solr's core for indexed documents. # SOLR_DOCS_HOST is the host for Apache Solr's core for indexed documents.
SOLR_DOCS_HOST="solr" SOLR_DOCS_HOST="solr"
@ -21,7 +23,7 @@ SOLR_DOCS_PORT=8983
# SOLR_DOCS_CORE_NAME is the core name for Apache Solr's core for indexed documents. # SOLR_DOCS_CORE_NAME is the core name for Apache Solr's core for indexed documents.
SOLR_DOCS_CORE_NAME="nm3clol_core" SOLR_DOCS_CORE_NAME="nm3clol_core"
# SOLR_DOCS_URL is the URL to access Apache Solr's core for indexed documents. It is used by Gulp and the Search feature. # SOLR_DOCS_URL is the URL to access Apache Solr's core for indexed documents. It is used by Gulp and the Search feature.
SOLR_DOCS_URL="http://$SOLR_DOCS_HOST:$SOLR_DOCS_PORT/solr/$SOLR_DOCS_CORE_NAME" SOLR_DOCS_URL="http://${SOLR_DOCS_HOST}:${SOLR_DOCS_PORT}/solr/${SOLR_DOCS_CORE_NAME}"
# SOLR_LAW_HOST is the host for Apache Solr's core for indexed laws. # SOLR_LAW_HOST is the host for Apache Solr's core for indexed laws.
SOLR_LAW_HOST="$SOLR_DOCS_HOST" SOLR_LAW_HOST="$SOLR_DOCS_HOST"
@ -30,11 +32,11 @@ SOLR_LAW_PORT=$SOLR_DOCS_PORT
# SOLR_LAW_CORE_NAME is the core name for Apache Solr's core for indexed laws. # SOLR_LAW_CORE_NAME is the core name for Apache Solr's core for indexed laws.
SOLR_LAW_CORE_NAME="vacode_core" SOLR_LAW_CORE_NAME="vacode_core"
# SOLR_LAW_URL is the URL to access Apache Solr's core for indexed laws. It is used by Gulp (and eventually the Search feature.) # SOLR_LAW_URL is the URL to access Apache Solr's core for indexed laws. It is used by Gulp (and eventually the Search feature.)
SOLR_LAW_URL="http://$SOLR_LAW_HOST:$SOLR_LAW_PORT/solr/$SOLR_LAW_CORE_NAME" SOLR_LAW_URL="http://${SOLR_LAW_HOST}:${SOLR_LAW_PORT}/solr/${SOLR_LAW_CORE_NAME}"
# TIKA_HOST is the URL to access the host running Apache Tika. # TIKA_HOST is the URL to access the host running Apache Tika.
TIKA_HOST="tika" TIKA_HOST="tika"
# TIKA_PORT is the URL to access the host running Apache Tika. # TIKA_PORT is the URL to access the host running Apache Tika.
TIKA_PORT=9998 TIKA_PORT=9998
# TIKA_URL is the URL to access the host running Apache Tika. # TIKA_URL is the URL to access the host running Apache Tika.
TIKA_URL="http://tika:$TIKA_PORT" TIKA_URL="http://${TIKA_HOST}:${TIKA_PORT}"

View File

@ -9,7 +9,10 @@ const ejs = require('ejs');
const helpers = require('../views/helpers/functions'); const helpers = require('../views/helpers/functions');
const search = require('../routes/search'); const search = require('../routes/search');
const fs = require('fs'); const fs = require('fs');
require('dotenv').config(); const dotenv = require('dotenv');
const dotenvExpand = require('dotenv-expand');
dotenv.config();
dotenvExpand.expand(process.env);
// const advancedSearch = require('../routes/advanced-search'); // const advancedSearch = require('../routes/advanced-search');
// Port number for HTTP server // Port number for HTTP server

View File

@ -5,14 +5,16 @@ SITE_NAME="(dev) No Moss 3 Carbo Landfill Online Localhost"
# SITE_HOST is used for generating links for the search index. (If you leave this blank it should work using relative paths.) # SITE_HOST is used for generating links for the search index. (If you leave this blank it should work using relative paths.)
SITE_HOST="localhost" SITE_HOST="localhost"
# SITE_URL is used for generating links for the search index. (If you leave this blank it should work using relative paths.) # SITE_URL is used for generating links for the search index. (If you leave this blank it should work using relative paths.)
SITE_URL="https://$SITE_HOST" SITE_URL="https://${SITE_HOST}"
# WELCOME_MSG is used for the homepage instead of "Welcome to ${SITE_NAME}!"
WELCOME_MSG="Devel' It Up, Developer!"
# APP_HTTP_LISTEN_PORT is the TCP port used to access the Node application's HTTP interface (usually by a reverse proxy). # APP_HTTP_LISTEN_PORT is the TCP port used to access the Node application's HTTP interface (usually by a reverse proxy).
APP_HTTP_HOST="nm3clol" APP_HTTP_HOST="nm3clol"
# APP_HTTP_LISTEN_PORT is the TCP port used to access the Node application's HTTP interface (usually by a reverse proxy). # APP_HTTP_LISTEN_PORT is the TCP port used to access the Node application's HTTP interface (usually by a reverse proxy).
APP_HTTP_LISTEN_PORT=3000 APP_HTTP_LISTEN_PORT=3000
# APP_URL is the URL used to access the Node application (usually by a reverse proxy). # APP_URL is the URL used to access the Node application (usually by a reverse proxy).
APP_HTTP_URL="http://$APP_HTTP_HOST:$APP_HTTP_LISTEN_PORT" APP_HTTP_URL="http://${APP_HTTP_HOST}:${APP_HTTP_LISTEN_PORT}"
# SOLR_DOCS_HOST is the host for Apache Solr's core for indexed documents. # SOLR_DOCS_HOST is the host for Apache Solr's core for indexed documents.
SOLR_DOCS_HOST="solr" SOLR_DOCS_HOST="solr"
@ -21,7 +23,7 @@ SOLR_DOCS_PORT=8983
# SOLR_DOCS_CORE_NAME is the core name for Apache Solr's core for indexed documents. # SOLR_DOCS_CORE_NAME is the core name for Apache Solr's core for indexed documents.
SOLR_DOCS_CORE_NAME="nm3clol_core" SOLR_DOCS_CORE_NAME="nm3clol_core"
# SOLR_DOCS_URL is the URL to access Apache Solr's core for indexed documents. It is used by Gulp and the Search feature. # SOLR_DOCS_URL is the URL to access Apache Solr's core for indexed documents. It is used by Gulp and the Search feature.
SOLR_DOCS_URL="http://$SOLR_DOCS_HOST:$SOLR_DOCS_PORT/solr/$SOLR_DOCS_CORE_NAME" SOLR_DOCS_URL="http://${SOLR_DOCS_HOST}:${SOLR_DOCS_PORT}/solr/${SOLR_DOCS_CORE_NAME}"
# SOLR_LAW_HOST is the host for Apache Solr's core for indexed laws. # SOLR_LAW_HOST is the host for Apache Solr's core for indexed laws.
SOLR_LAW_HOST="$SOLR_DOCS_HOST" SOLR_LAW_HOST="$SOLR_DOCS_HOST"
@ -30,11 +32,11 @@ SOLR_LAW_PORT=$SOLR_DOCS_PORT
# SOLR_LAW_CORE_NAME is the core name for Apache Solr's core for indexed laws. # SOLR_LAW_CORE_NAME is the core name for Apache Solr's core for indexed laws.
SOLR_LAW_CORE_NAME="vacode_core" SOLR_LAW_CORE_NAME="vacode_core"
# SOLR_LAW_URL is the URL to access Apache Solr's core for indexed laws. It is used by Gulp (and eventually the Search feature.) # SOLR_LAW_URL is the URL to access Apache Solr's core for indexed laws. It is used by Gulp (and eventually the Search feature.)
SOLR_LAW_URL="http://$SOLR_LAW_HOST:$SOLR_LAW_PORT/solr/$SOLR_LAW_CORE_NAME" SOLR_LAW_URL="http://${SOLR_LAW_HOST}:${SOLR_LAW_PORT}/solr/${SOLR_LAW_CORE_NAME}"
# TIKA_HOST is the URL to access the host running Apache Tika. # TIKA_HOST is the URL to access the host running Apache Tika.
TIKA_HOST="tika" TIKA_HOST="tika"
# TIKA_PORT is the URL to access the host running Apache Tika. # TIKA_PORT is the URL to access the host running Apache Tika.
TIKA_PORT=9998 TIKA_PORT=9998
# TIKA_URL is the URL to access the host running Apache Tika. # TIKA_URL is the URL to access the host running Apache Tika.
TIKA_URL="http://tika:$TIKA_PORT" TIKA_URL="http://${TIKA_HOST}:${TIKA_PORT}"

View File

@ -8,7 +8,10 @@ const crypto = require('crypto');
const url = require('url') const url = require('url')
const { TikaClient } = require('./app/TikaClient/build'); const { TikaClient } = require('./app/TikaClient/build');
const { Readable, Writable } = require('stream'); const { Readable, Writable } = require('stream');
require('dotenv').config(); const dotenv = require('dotenv');
const dotenvExpand = require('dotenv-expand');
dotenv.config();
dotenvExpand.expand(process.env);
const relPathToFiles = './public'; const relPathToFiles = './public';

15
package-lock.json generated
View File

@ -14,6 +14,7 @@
"cheerio": "^1.0.0-rc.12", "cheerio": "^1.0.0-rc.12",
"content-disposition": "0.5.2", "content-disposition": "0.5.2",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"dotenv-expand": "^11.0.6",
"ejs": "^3.1.9", "ejs": "^3.1.9",
"express": "^4.18.3", "express": "^4.18.3",
"fast-url-parser": "1.1.3", "fast-url-parser": "1.1.3",
@ -5456,6 +5457,20 @@
"url": "https://dotenvx.com" "url": "https://dotenvx.com"
} }
}, },
"node_modules/dotenv-expand": {
"version": "11.0.6",
"resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-11.0.6.tgz",
"integrity": "sha512-8NHi73otpWsZGBSZwwknTXS5pqMOrk9+Ssrna8xCaxkzEpU9OTf9R5ArQGVw03//Zmk9MOwLPng9WwndvpAJ5g==",
"dependencies": {
"dotenv": "^16.4.4"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://dotenvx.com"
}
},
"node_modules/duplexer": { "node_modules/duplexer": {
"version": "0.1.2", "version": "0.1.2",
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz",

View File

@ -21,6 +21,7 @@
"cheerio": "^1.0.0-rc.12", "cheerio": "^1.0.0-rc.12",
"content-disposition": "0.5.2", "content-disposition": "0.5.2",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"dotenv-expand": "^11.0.6",
"ejs": "^3.1.9", "ejs": "^3.1.9",
"express": "^4.18.3", "express": "^4.18.3",
"fast-url-parser": "1.1.3", "fast-url-parser": "1.1.3",

View File

@ -20,7 +20,7 @@
<% } %> <% } %>
<% if (h.shouldShowWelcomeBanner({paths})) { %> <% if (h.shouldShowWelcomeBanner({paths})) { %>
<i>&nbsp;</i> <i>&nbsp;</i>
Get Informed! Stay Informed! <%= h.getWelcomeBanner() %>
<% } else if (h.shouldOmitLinkOnLastBreadcrumb({paths, index})) { %> <% } else if (h.shouldOmitLinkOnLastBreadcrumb({paths, index})) { %>
<%= h.trimSlashes({path: value.name}).replaceAll('_', ' ') %> <%= h.trimSlashes({path: value.name}).replaceAll('_', ' ') %>
<% } else { %> <% } else { %>

View File

@ -19,7 +19,7 @@ const md = markdownit({
const moment = require('moment-timezone').tz.setDefault("UTC"); const moment = require('moment-timezone').tz.setDefault("UTC");
const getSiteName = () => { const getSiteName = () => {
return process.env.SITE_NAME||'No Moss 3 Carbo Landfill Online Library'; return process.env.SITE_NAME || '(dev) No Moss 3 Carbo Landfill Online Localhost';
} }
const trimSlashes = ({path}) => { const trimSlashes = ({path}) => {
@ -40,9 +40,8 @@ const getDirectoryTitle = ({directory}) => {
.join(' - '); .join(' - ');
return (directory=="public") ? getSiteName() : `${title} - ${getSiteName()}`; return (directory=="public") ? getSiteName() : `${title} - ${getSiteName()}`;
}; };
const getWelcomeBanner = ({directory}) => { const getWelcomeBanner = () => {
//return trimSlashes({path: directory.replace("public", `Welcome to ${getSiteName()}`)}); return process.env.WELCOME_MSG || `Welcome to ${getSiteName()}!`;
return "Get Informed! Stay Informed!";
}; };
const shouldShowDirectorySeparator = ({index}) => (index > 0); const shouldShowDirectorySeparator = ({index}) => (index > 0);
const shouldShowWelcomeBanner = ({paths}) => (paths.length == 1); const shouldShowWelcomeBanner = ({paths}) => (paths.length == 1);