diff --git a/app/config.mts b/app/config.mts index 3ab4eedd..9ff45f88 100644 --- a/app/config.mts +++ b/app/config.mts @@ -2,188 +2,186 @@ * The `ProcessEnv` interface represents the imported environment variables to input from `process.env` dictionary. */ export interface ProcessEnv { - /** - * `APP_HTTP_LISTEN_HOST` is the host for the HTTP web app. - */ - APP_HTTP_HOST?: string; - /** - * `APP_HTTP_LISTEN_PORT` is the TCP port used to access the Node application's HTTP interface (usually by a reverse proxy). - */ - APP_HTTP_PORT?: string; - /** - * `APP_URL` is the URL used to access the Node application (usually by a reverse proxy). - */ - APP_HTTP_URL?: string; - /** - * `SITE_NAME` is used for page generation. - */ - SITE_NAME?: string; - /** - * `SITE_HOST` is used for generating links for the search index. (If you leave this blank it should work using relative paths.) - */ - SITE_WELCOME_MESSAGE?: string; - /** - * `SITE_URL` is used for generating links for the search index. (If you leave this blank it should work using relative paths.) - */ - SITE_HOST?: string; - /** - * `WELCOME_MESSAGE` is used for the homepage instead of `"Welcome to ${SITE_NAME}!"` - */ - SITE_URL?: string; - /** - * `PUBLIC_PATH` is the relative path to the directory to this project root for the public files. - */ - PUBLIC_PATH?: string; - /** - * `PAGES_PATH` is the relative path to the directory to this project root for the pages rather than public files. - */ - PAGES_PATH?: string; - /** - * `ASSETS_PATH` is the relative path to the directory to this project root for the static asset files. - */ - ASSETS_PATH?: string; - /** - * `SOLR_DOCS_HOST` is the host for Apache Solr's core for indexed documents. - */ - SOLR_DOCS_HOST?: string; - /** - * `SOLR_DOCS_PORT` is the port for Apache Solr's core for indexed documents. - */ - SOLR_DOCS_PORT?: string; - /** - * `SOLR_DOCS_CORE` is the core name for Apache Solr's core for indexed documents. - */ - SOLR_DOCS_CORE?: string; - /** - * `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?: string; - /** - * `SOLR_LAW_HOST` is the host for Apache Solr's core for indexed laws. - */ - SOLR_LAW_HOST?: string; - /** - * `SOLR_LAW_PORT` is the port for Apache Solr's core for indexed laws. - */ - SOLR_LAW_PORT?: string; - /** - * `SOLR_LAW_CORE` is the core name for Apache Solr's core for indexed laws. - */ - SOLR_LAW_CORE?: string; - /** - * `SOLR_LAW_URL` is the URL to access Apache Solr's core for indexed laws. It is used by Gulp and the Search feature. - */ - SOLR_LAW_URL?: string; - /** - * `TIKA_HOST` is the host to access the Apache Tika app. - */ - TIKA_HOST?: string; - /** - * `TIKA_PORT` is the port to access the Apache Tika app. - */ - TIKA_PORT?: string; - /** - * `TIKA_URL` is the URL to access the Apache Tika app. - */ - TIKA_URL?: string; + /** + * `APP_HTTP_LISTEN_HOST` is the host for the HTTP web app. + */ + APP_HTTP_HOST?: string; + /** + * `APP_HTTP_LISTEN_PORT` is the TCP port used to access the Node application's HTTP interface (usually by a reverse proxy). + */ + APP_HTTP_PORT?: string; + /** + * `APP_URL` is the URL used to access the Node application (usually by a reverse proxy). + */ + APP_HTTP_URL?: string; + /** + * `SITE_NAME` is used for page generation. + */ + SITE_NAME?: string; + /** + * `SITE_HOST` is used for generating links for the search index. (If you leave this blank it should work using relative paths.) + */ + SITE_WELCOME_MESSAGE?: string; + /** + * `SITE_URL` is used for generating links for the search index. (If you leave this blank it should work using relative paths.) + */ + SITE_HOST?: string; + /** + * `WELCOME_MESSAGE` is used for the homepage instead of `"Welcome to ${SITE_NAME}!"` + */ + SITE_URL?: string; + /** + * `PUBLIC_PATH` is the relative path to the directory to this project root for the public files. + */ + PUBLIC_PATH?: string; + /** + * `PAGES_PATH` is the relative path to the directory to this project root for the pages rather than public files. + */ + PAGES_PATH?: string; + /** + * `ASSETS_PATH` is the relative path to the directory to this project root for the static asset files. + */ + ASSETS_PATH?: string; + /** + * `SOLR_DOCS_HOST` is the host for Apache Solr's core for indexed documents. + */ + SOLR_DOCS_HOST?: string; + /** + * `SOLR_DOCS_PORT` is the port for Apache Solr's core for indexed documents. + */ + SOLR_DOCS_PORT?: string; + /** + * `SOLR_DOCS_CORE` is the core name for Apache Solr's core for indexed documents. + */ + SOLR_DOCS_CORE?: string; + /** + * `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?: string; + /** + * `SOLR_LAW_HOST` is the host for Apache Solr's core for indexed laws. + */ + SOLR_LAW_HOST?: string; + /** + * `SOLR_LAW_PORT` is the port for Apache Solr's core for indexed laws. + */ + SOLR_LAW_PORT?: string; + /** + * `SOLR_LAW_CORE` is the core name for Apache Solr's core for indexed laws. + */ + SOLR_LAW_CORE?: string; + /** + * `SOLR_LAW_URL` is the URL to access Apache Solr's core for indexed laws. It is used by Gulp and the Search feature. + */ + SOLR_LAW_URL?: string; + /** + * `TIKA_HOST` is the host to access the Apache Tika app. + */ + TIKA_HOST?: string; + /** + * `TIKA_PORT` is the port to access the Apache Tika app. + */ + TIKA_PORT?: string; + /** + * `TIKA_URL` is the URL to access the Apache Tika app. + */ + TIKA_URL?: string; } /** * The `Config` interface represents the imported environment variables after imported from `process.env` dictionary. */ export interface Config { - /** - * `appHttpHost` is the host for the HTTP web app. - */ - appHttpHost: string; - /** - * `appHttpPort` is the TCP port used to access the Node application's HTTP interface (usually by a reverse proxy). - */ - appHttpPort: number|string; - /** - * `appHttpUrl` is the URL used to access the Node application (usually by a reverse proxy). - */ - appHttpUrl: string; - /** - * `siteName` is used for page generation. - */ - siteName: string; - /** - * `siteWelcomeMessage` is used for the homepage instead of `"Welcome to ${process.env['SITE_NAME']}!"` - */ - siteWelcomeMessage: string; - /** - * `siteHost` is used for generating links for the search index. (If you leave this blank it should work using relative paths.) - */ - siteHost: string; - /** - * `siteUrl` is used for generating links for the search index. (If you leave this blank it should work using relative paths.) - */ - siteUrl: string; - /** - * `publicPath` is the relative path to the directory to this project root for the public files. - */ - publicPath: string; - /** - * `pagesPath` is the relative path to the directory to this project root for the pages rather than public files. - */ - pagesPath: string; - /** - * `assetsPath` is the relative path to the directory to this project root for the static asset files. - */ - assetsPath: string; - /** - * `viewsPath' is the relative path to the directory to this project root for the view templates. - */ - viewsPath: string; - /** - * `solrDocsHost` is the host for Apache Solr's core for indexed documents. - */ - solrDocsHost: string; - /** - * `solrDocsPort` is the port for Apache Solr's core for indexed documents. - */ - solrDocsPort: number|string; - /** - * `solrDocsCore` is the core name for Apache Solr's core for indexed documents. - */ - solrDocsCore: string; - /** - * `solrDocsUrl` is the URL to access Apache Solr's core for indexed documents. It is used by Gulp and the Search feature. - */ - solrDocsUrl: string; - /** - * `solrLawHost` is the host for Apache Solr's core for indexed laws. - */ - solrLawHost: string; - /** - * `solrLawPort` is the port for Apache Solr's core for indexed laws. - */ - solrLawPort: number|string; - /** - * `solrLawCore` is the core name for Apache Solr's core for indexed laws. - */ - solrLawCore: string; - /** - * `solrLawUrl` is the URL to access Apache Solr's core for indexed laws. It is used by Gulp and the Search feature. - */ - solrLawUrl: string; - /** - * `tikaHost` is the host to access the Apache Tika app. - */ - tikaHost: string; - /** - * `tikaPort` is the port to access the Apache Tika app. - */ - tikaPort: string|number; - /** - * `tikaUrl` is the URL to access the Apache Tika app. - */ - tikaUrl: string; + /** + * `appHttpHost` is the host for the HTTP web app. + */ + appHttpHost: string; + /** + * `appHttpPort` is the TCP port used to access the Node application's HTTP interface (usually by a reverse proxy). + */ + appHttpPort: number|string; + /** + * `appHttpUrl` is the URL used to access the Node application (usually by a reverse proxy). + */ + appHttpUrl: string; + /** + * `siteName` is used for page generation. + */ + siteName: string; + /** + * `siteWelcomeMessage` is used for the homepage instead of `"Welcome to ${process.env['SITE_NAME']}!"` + */ + siteWelcomeMessage: string; + /** + * `siteHost` is used for generating links for the search index. (If you leave this blank it should work using relative paths.) + */ + siteHost: string; + /** + * `siteUrl` is used for generating links for the search index. (If you leave this blank it should work using relative paths.) + */ + siteUrl: string; + /** + * `publicPath` is the relative path to the directory to this project root for the public files. + */ + publicPath: string; + /** + * `pagesPath` is the relative path to the directory to this project root for the pages rather than public files. + */ + pagesPath: string; + /** + * `assetsPath` is the relative path to the directory to this project root for the static asset files. + */ + assetsPath: string; + /** + * `viewsPath' is the relative path to the directory to this project root for the view templates. + */ + viewsPath: string; + /** + * `solrDocsHost` is the host for Apache Solr's core for indexed documents. + */ + solrDocsHost: string; + /** + * `solrDocsPort` is the port for Apache Solr's core for indexed documents. + */ + solrDocsPort: number|string; + /** + * `solrDocsCore` is the core name for Apache Solr's core for indexed documents. + */ + solrDocsCore: string; + /** + * `solrDocsUrl` is the URL to access Apache Solr's core for indexed documents. It is used by Gulp and the Search feature. + */ + solrDocsUrl: string; + /** + * `solrLawHost` is the host for Apache Solr's core for indexed laws. + */ + solrLawHost: string; + /** + * `solrLawPort` is the port for Apache Solr's core for indexed laws. + */ + solrLawPort: number|string; + /** + * `solrLawCore` is the core name for Apache Solr's core for indexed laws. + */ + solrLawCore: string; + /** + * `solrLawUrl` is the URL to access Apache Solr's core for indexed laws. It is used by Gulp and the Search feature. + */ + solrLawUrl: string; + /** + * `tikaHost` is the host to access the Apache Tika app. + */ + tikaHost: string; + /** + * `tikaPort` is the port to access the Apache Tika app. + */ + tikaPort: string|number; + /** + * `tikaUrl` is the URL to access the Apache Tika app. + */ + tikaUrl: string; } -console.log(`Configuring .env and expanding .env to include environment variable references.`); - import path from 'path'; import dotenv from 'dotenv'; import dotenvExpand from 'dotenv-expand'; @@ -195,20 +193,20 @@ const __dirname = path.dirname(__filename); const env: ProcessEnv = {}; let dotEnvConfig = dotenv.config({ - path: path.join(__dirname, '.env'), - processEnv: dotenv.config({ - path: path.join(__dirname, '..', '..', '.env'), - processEnv: env as dotenv.DotenvPopulateInput}) as dotenv.DotenvPopulateInput - }); + path: path.join(__dirname, '.env'), + processEnv: dotenv.config({ + path: path.join(__dirname, '..', '..', '.env'), + processEnv: env as dotenv.DotenvPopulateInput}) as dotenv.DotenvPopulateInput + }); dotEnvConfig = dotenvExpand.expand({ - parsed: env as dotenvExpand.DotenvParseInput, - processEnv: process.env as dotenvExpand.DotenvParseInput + parsed: env as dotenvExpand.DotenvParseInput, + processEnv: process.env as dotenvExpand.DotenvParseInput }); export const getAppHttpHost = () => env.APP_HTTP_HOST||'nm3clol-express-app'; export const getAppHttpPort = () => process.env.PORT||env.APP_HTTP_PORT||3000; export const getAppHttpUrl = () => { - return env.APP_HTTP_URL || `http://${getAppHttpHost() + ((getAppHttpPort() == '80') ? '' : ':' + getAppHttpPort())}` + return env.APP_HTTP_URL || `http://${getAppHttpHost() + ((getAppHttpPort() == '80') ? '' : ':' + getAppHttpPort())}` }; export const getSiteName = () => env.SITE_NAME||"(dev) No Moss 3 Carbo Landfill Online Localhost"; @@ -237,31 +235,31 @@ export const getTikaPort = () => parseInt(env.TIKA_PORT||'9998'); export const getTikaUrl = () => env.TIKA_URL||`http://${getTikaHost()}:${getTikaPort()}`; export const config: Config = { - appHttpHost: getAppHttpHost(), - appHttpPort: getAppHttpPort(), - appHttpUrl: getAppHttpUrl(), + appHttpHost: getAppHttpHost(), + appHttpPort: getAppHttpPort(), + appHttpUrl: getAppHttpUrl(), - siteName: getSiteName(), - siteWelcomeMessage: getSiteWelcomeMessage(), - siteHost: getSiteHost(), - siteUrl: getSiteUrl(), + siteName: getSiteName(), + siteWelcomeMessage: getSiteWelcomeMessage(), + siteHost: getSiteHost(), + siteUrl: getSiteUrl(), - publicPath: getPublicPath(), - pagesPath: getPagesPath(), - assetsPath: getAssetsPath(), - viewsPath: getViewsPath(), + publicPath: getPublicPath(), + pagesPath: getPagesPath(), + assetsPath: getAssetsPath(), + viewsPath: getViewsPath(), - solrDocsHost: getSolrDocsHost(), - solrDocsPort: getSolrDocsPort(), - solrDocsCore: getSolrDocsCore(), - solrDocsUrl: getSolrDocsUrl(), + solrDocsHost: getSolrDocsHost(), + solrDocsPort: getSolrDocsPort(), + solrDocsCore: getSolrDocsCore(), + solrDocsUrl: getSolrDocsUrl(), - solrLawHost: getSolrLawHost(), - solrLawPort: getSolrLawPort(), - solrLawCore: getSolrLawCore(), - solrLawUrl: getSolrLawCore(), + solrLawHost: getSolrLawHost(), + solrLawPort: getSolrLawPort(), + solrLawCore: getSolrLawCore(), + solrLawUrl: getSolrLawCore(), - tikaHost: getTikaHost(), - tikaPort: getTikaPort(), - tikaUrl: getTikaUrl(), + tikaHost: getTikaHost(), + tikaPort: getTikaPort(), + tikaUrl: getTikaUrl(), };