-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* blockchain:Joi env vars validation * temp * blockchain:Finilize Joi validation and config * blockchain:Finilize Joi validation and config * blockchain:Use latest script in dosc generation * email-notofocation-service:Add joi validation * excel-export:Add joi validation to env vars * Add empty() to Joi.Add checking of validation script output * Fix correctly passing env vars to script * Merge main * scripts:Fix issues on startup * scripts:Fix issues on startup * modified envVarsSchema * when value defaults then it is not required --------- Co-authored-by: Peter Baus <peter.baus@accenture.com> Co-authored-by: Samuel Pull <samuel.pull@accenture.com>
- Loading branch information
1 parent
a620eb4
commit e037bf1
Showing
36 changed files
with
1,901 additions
and
340 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
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,27 @@ | ||
const { writeFileSync } = require("fs"); | ||
const { generateMarkdownFile } = require("../../scripts/common/envVarsGenerator/dist"); | ||
const { envVarsSchema } = require("../src/envVarsSchema"); | ||
|
||
function updateReadme() { | ||
const mdTable = generateMarkdownFile(envVarsSchema); | ||
|
||
const md = `# Trubudget Blockchain | ||
## Environment Variables | ||
Depending on the Trubudget setup environment variables | ||
${mdTable} | ||
## Connected services | ||
### Email-Service | ||
The email-service can be configured via the following environment variables. | ||
To get started have a look at dedicated [documentation](../email-notification-service/README.md) | ||
`; | ||
|
||
writeFileSync("./environment-variables.md", md, "utf-8"); | ||
} | ||
|
||
updateReadme(); |
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,8 @@ | ||
const { envVarsSchema } = require("../src/envVarsSchema"); | ||
|
||
const { error } = envVarsSchema.validate(process.env, { abortEarly: false }); | ||
if (error) { | ||
console.log(`Config validation error: ${error.message}`); | ||
} else { | ||
console.log("Environment variables are valid."); | ||
} |
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,55 @@ | ||
const { envVarsSchema } = require("./envVarsSchema"); | ||
|
||
const { error, value: envVars } = envVarsSchema.validate(process.env); | ||
if (error) { | ||
throw new Error(`Config validation error: ${error.message}`); | ||
} | ||
|
||
const config = { | ||
orgazation: envVars.ORGANIZATION, | ||
port: envVars.PORT, | ||
multichain: { | ||
rpcPort: envVars.MULTICHAIN_RPC_PORT, | ||
rpcUser: envVars.MULTICHAIN_RPC_USER, | ||
rpcPassword: envVars.MULTICHAIN_RPC_PASSWORD, | ||
rpcAllowIp: envVars.RPC_ALLOW_IP, | ||
dir: envVars.MULTICHAIN_DIR, | ||
}, | ||
api: { | ||
protocol: envVars.API_PROTOCOL, | ||
host: envVars.API_HOST, | ||
port: envVars.API_PORT, | ||
}, | ||
p2p: { | ||
host: envVars.P2P_HOST, | ||
port: envVars.P2P_PORT, | ||
}, | ||
email: { | ||
host: envVars.EMAIL_HOST, | ||
port: envVars.EMAIL_PORT, | ||
ssl: envVars.EMAIL_SSL, | ||
serviceEnabled: envVars.EMAIL_SERVICE_ENABLED, | ||
jwtSecret: envVars.JWT_SECRET, | ||
}, | ||
notification: { | ||
path: envVars.NOTIFICATION_PATH, | ||
maxLifetime: envVars.NOTIFICATION_MAX_LIFETIME, | ||
sendInterval: envVars.NOTIFICATION_SEND_INTERVAL, | ||
}, | ||
cert: { | ||
path: envVars.CERT_PATH, | ||
caPath: envVars.CERT_CA_PATH, | ||
keyPath: envVars.CERT_KEY_PATH, | ||
}, | ||
externalIp: envVars.EXTERNAL_IP, | ||
autostart: envVars.AUTOSTART, | ||
emailServiceEnabled: envVars.EMAIL_SERVICE_ENABLED, | ||
multichainFeedEnabled: envVars.MULTICHAIN_FEED_ENABLED, | ||
nodeEnv: envVars.NODE_ENV, | ||
blocknotifyScript: envVars.BLOCKNOTIFY_SCRIPT, | ||
kubeServiceName: envVars.KUBE_SERVICE_NAME, | ||
kubeNamespace: envVars.KUBE_NAMESPACE, | ||
exposeMc: envVars.EXPOSE_MC, | ||
}; | ||
|
||
module.exports = config; |
Oops, something went wrong.