-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [snyk] fix vulnerabilities * move all process.env in one config * update log level in config * check envs * fix imports in tests for microsoft, soniox, deepgram * fix import in gather-test * fix missing imports --------- Co-authored-by: Markus Frindt <[email protected]>
- Loading branch information
1 parent
5d50f68
commit 86df53f
Showing
28 changed files
with
430 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
const assert = require('assert'); | ||
|
||
const checkEnvs = () => { | ||
assert.ok(process.env.JAMBONES_MYSQL_HOST && | ||
process.env.JAMBONES_MYSQL_USER && | ||
process.env.JAMBONES_MYSQL_PASSWORD && | ||
process.env.JAMBONES_MYSQL_DATABASE, 'missing JAMBONES_MYSQL_XXX env vars'); | ||
assert.ok(process.env.DRACHTIO_PORT || process.env.DRACHTIO_HOST, 'missing DRACHTIO_PORT env var'); | ||
assert.ok(process.env.DRACHTIO_SECRET, 'missing DRACHTIO_SECRET env var'); | ||
assert.ok(process.env.JAMBONES_FREESWITCH, 'missing JAMBONES_FREESWITCH env var'); | ||
assert.ok(process.env.JAMBONES_REDIS_HOST, 'missing JAMBONES_REDIS_HOST env var'); | ||
assert.ok(process.env.JAMBONES_NETWORK_CIDR || process.env.K8S, 'missing JAMBONES_SUBNET env var'); | ||
}; | ||
|
||
const NODE_ENV = process.env.NODE_ENV; | ||
|
||
/* database mySQL */ | ||
const JAMBONES_MYSQL_HOST = process.env.JAMBONES_MYSQL_HOST; | ||
const JAMBONES_MYSQL_USER = process.env.JAMBONES_MYSQL_USER; | ||
const JAMBONES_MYSQL_PASSWORD = process.env.JAMBONES_MYSQL_PASSWORD; | ||
const JAMBONES_MYSQL_DATABASE = process.env.JAMBONES_MYSQL_DATABASE; | ||
const JAMBONES_MYSQL_PORT = parseInt(process.env.JAMBONES_MYSQL_PORT, 10) || 3306; | ||
const JAMBONES_MYSQL_REFRESH_TTL = process.env.JAMBONES_MYSQL_REFRESH_TTL; | ||
const JAMBONES_MYSQL_CONNECTION_LIMIT = parseInt(process.env.JAMBONES_MYSQL_CONNECTION_LIMIT, 10) || 10; | ||
|
||
/* redis */ | ||
const JAMBONES_REDIS_HOST = process.env.JAMBONES_REDIS_HOST; | ||
const JAMBONES_REDIS_PORT = parseInt(process.env.JAMBONES_REDIS_PORT, 10) || 6379; | ||
|
||
/* gather and hints */ | ||
const JAMBONES_GATHER_EARLY_HINTS_MATCH = process.env.JAMBONES_GATHER_EARLY_HINTS_MATCH; | ||
const JAMBONZ_GATHER_EARLY_HINTS_MATCH = process.env.JAMBONZ_GATHER_EARLY_HINTS_MATCH; | ||
const JAMBONES_GATHER_CLEAR_GLOBAL_HINTS_ON_EMPTY_HINTS = process.env.JAMBONES_GATHER_CLEAR_GLOBAL_HINTS_ON_EMPTY_HINTS; | ||
|
||
const SMPP_URL = process.env.SMPP_URL; | ||
|
||
/* drachtio */ | ||
const DRACHTIO_PORT = process.env.DRACHTIO_PORT; | ||
const DRACHTIO_HOST = process.env.DRACHTIO_HOST; | ||
const DRACHTIO_SECRET = process.env.DRACHTIO_SECRET; | ||
|
||
/* freeswitch */ | ||
const JAMBONES_API_BASE_URL = process.env.JAMBONES_API_BASE_URL; | ||
const JAMBONES_FREESWITCH = process.env.JAMBONES_FREESWITCH; | ||
const JAMBONES_FREESWITCH_MAX_CALL_DURATION_MINS = parseInt(process.env.JAMBONES_FREESWITCH_MAX_CALL_DURATION_MINS, 10) | ||
|| 180; | ||
|
||
|
||
const JAMBONES_SBCS = process.env.JAMBONES_SBCS; | ||
|
||
/* websockets */ | ||
const JAMBONES_WS_HANDSHAKE_TIMEOUT_MS = parseInt(process.env.JAMBONES_WS_HANDSHAKE_TIMEOUT_MS, 10) || 1500; | ||
const JAMBONES_WS_MAX_PAYLOAD = parseInt(process.env.JAMBONES_WS_MAX_PAYLOAD, 10) || 24 * 1024; | ||
|
||
const MAX_RECONNECTS = 5; | ||
const RESPONSE_TIMEOUT_MS = parseInt(process.env.JAMBONES_WS_API_MSG_RESPONSE_TIMEOUT, 10) || 5000; | ||
|
||
const JAMBONES_NETWORK_CIDR = process.env.JAMBONES_NETWORK_CIDR; | ||
const JAMBONES_TIME_SERIES_HOST = process.env.JAMBONES_TIME_SERIES_HOST; | ||
const JAMBONES_CLUSTER_ID = process.env.JAMBONES_CLUSTER_ID || 'default'; | ||
const JAMBONES_ESL_LISTEN_ADDRESS = process.env.JAMBONES_ESL_LISTEN_ADDRESS; | ||
|
||
/* tracing */ | ||
const JAMBONES_OTEL_ENABLED = process.env.JAMBONES_OTEL_ENABLED; | ||
const JAMBONES_OTEL_SERVICE_NAME = process.env.JAMBONES_OTEL_SERVICE_NAME || 'jambonz-feature-server'; | ||
const OTEL_EXPORTER_JAEGER_AGENT_HOST = process.env.OTEL_EXPORTER_JAEGER_AGENT_HOST; | ||
const OTEL_EXPORTER_ZIPKIN_URL = process.env.OTEL_EXPORTER_ZIPKIN_URL; | ||
const OTEL_EXPORTER_COLLECTOR_URL = process.env.OTEL_EXPORTER_COLLECTOR_URL; | ||
|
||
const JAMBONES_LOGLEVEL = process.env.JAMBONES_LOGLEVEL || 'info'; | ||
const JAMBONES_INJECT_CONTENT = process.env.JAMBONES_INJECT_CONTENT; | ||
|
||
const PORT = parseInt(process.env.HTTP_PORT, 10) || 3000; | ||
const HTTP_PORT_MAX = parseInt(process.env.HTTP_PORT_MAX, 10); | ||
|
||
const K8S = process.env.K8S; | ||
const K8S_SBC_SIP_SERVICE_NAME = process.env.K8S_SBC_SIP_SERVICE_NAME; | ||
|
||
const JAMBONES_SUBNET = process.env.JAMBONES_SUBNET; | ||
|
||
/* clean up */ | ||
const JAMBONZ_CLEANUP_INTERVAL_MINS = process.env.JAMBONZ_CLEANUP_INTERVAL_MINS; | ||
const getCleanupIntervalMins = () => { | ||
const interval = parseInt(JAMBONZ_CLEANUP_INTERVAL_MINS, 10) || 60; | ||
return 1000 * 60 * interval; | ||
}; | ||
|
||
/* speech vendors */ | ||
const AWS_REGION = process.env.AWS_REGION; | ||
const AWS_ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID; | ||
const AWS_SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY; | ||
const AWS_SNS_PORT = parseInt(process.env.AWS_SNS_PORT, 10) || 3001; | ||
const AWS_SNS_TOPIC_ARM = process.env.AWS_SNS_TOPIC_ARM; | ||
const AWS_SNS_PORT_MAX = parseInt(process.env.AWS_SNS_PORT_MAX, 10) || 3005; | ||
|
||
const GCP_JSON_KEY = process.env.GCP_JSON_KEY; | ||
|
||
const MICROSOFT_REGION = process.env.MICROSOFT_REGION; | ||
const MICROSOFT_API_KEY = process.env.MICROSOFT_API_KEY; | ||
|
||
const SONIOX_API_KEY = process.env.SONIOX_API_KEY; | ||
|
||
const DEEPGRAM_API_KEY = process.env.DEEPGRAM_API_KEY; | ||
|
||
const ANCHOR_MEDIA_ALWAYS = process.env.ANCHOR_MEDIA_ALWAYS; | ||
const VMD_HINTS_FILE = process.env.VMD_HINTS_FILE; | ||
|
||
/* security, secrets */ | ||
const LEGACY_CRYPTO = !!process.env.LEGACY_CRYPTO; | ||
const JWT_SECRET = process.env.JWT_SECRET; | ||
const ENCRYPTION_SECRET = process.env.ENCRYPTION_SECRET; | ||
|
||
/* HTTP/1 pool dispatcher */ | ||
const HTTP_POOL = process.env.HTTP_POOL && parseInt(process.env.HTTP_POOL); | ||
const HTTP_POOLSIZE = parseInt(process.env.HTTP_POOLSIZE, 10) || 10; | ||
const HTTP_PIPELINING = parseInt(process.env.HTTP_PIPELINING, 10) || 1; | ||
const HTTP_TIMEOUT = 10000; | ||
|
||
const OPTIONS_PING_INTERVAL = parseInt(process.env.OPTIONS_PING_INTERVAL, 10) || 30000; | ||
|
||
module.exports = { | ||
JAMBONES_MYSQL_HOST, | ||
JAMBONES_MYSQL_USER, | ||
JAMBONES_MYSQL_PASSWORD, | ||
JAMBONES_MYSQL_DATABASE, | ||
JAMBONES_MYSQL_REFRESH_TTL, | ||
JAMBONES_MYSQL_CONNECTION_LIMIT, | ||
JAMBONES_MYSQL_PORT, | ||
|
||
DRACHTIO_PORT, | ||
DRACHTIO_HOST, | ||
DRACHTIO_SECRET, | ||
|
||
JAMBONES_GATHER_EARLY_HINTS_MATCH, | ||
JAMBONZ_GATHER_EARLY_HINTS_MATCH, | ||
JAMBONES_GATHER_CLEAR_GLOBAL_HINTS_ON_EMPTY_HINTS, | ||
JAMBONES_FREESWITCH, | ||
JAMBONES_REDIS_HOST, | ||
JAMBONES_REDIS_PORT, | ||
SMPP_URL, | ||
JAMBONES_NETWORK_CIDR, | ||
JAMBONES_API_BASE_URL, | ||
JAMBONES_TIME_SERIES_HOST, | ||
JAMBONES_INJECT_CONTENT, | ||
JAMBONES_ESL_LISTEN_ADDRESS, | ||
JAMBONES_SBCS, | ||
JAMBONES_OTEL_ENABLED, | ||
JAMBONES_OTEL_SERVICE_NAME, | ||
OTEL_EXPORTER_JAEGER_AGENT_HOST, | ||
OTEL_EXPORTER_ZIPKIN_URL, | ||
OTEL_EXPORTER_COLLECTOR_URL, | ||
|
||
JAMBONES_LOGLEVEL, | ||
JAMBONES_CLUSTER_ID, | ||
PORT, | ||
HTTP_PORT_MAX, | ||
K8S, | ||
K8S_SBC_SIP_SERVICE_NAME, | ||
JAMBONES_SUBNET, | ||
NODE_ENV, | ||
JAMBONZ_CLEANUP_INTERVAL_MINS, | ||
getCleanupIntervalMins, | ||
checkEnvs, | ||
|
||
AWS_REGION, | ||
AWS_ACCESS_KEY_ID, | ||
AWS_SECRET_ACCESS_KEY, | ||
AWS_SNS_PORT, | ||
AWS_SNS_TOPIC_ARM, | ||
AWS_SNS_PORT_MAX, | ||
|
||
ANCHOR_MEDIA_ALWAYS, | ||
VMD_HINTS_FILE, | ||
JAMBONES_FREESWITCH_MAX_CALL_DURATION_MINS, | ||
|
||
LEGACY_CRYPTO, | ||
JWT_SECRET, | ||
ENCRYPTION_SECRET, | ||
HTTP_POOL, | ||
HTTP_POOLSIZE, | ||
HTTP_PIPELINING, | ||
HTTP_TIMEOUT, | ||
OPTIONS_PING_INTERVAL, | ||
RESPONSE_TIMEOUT_MS, | ||
JAMBONES_WS_HANDSHAKE_TIMEOUT_MS, | ||
JAMBONES_WS_MAX_PAYLOAD, | ||
MAX_RECONNECTS, | ||
GCP_JSON_KEY, | ||
MICROSOFT_REGION, | ||
MICROSOFT_API_KEY, | ||
SONIOX_API_KEY, | ||
DEEPGRAM_API_KEY | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.