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