Skip to content
Snippets Groups Projects
Commit e15b7782 authored by Éloïs's avatar Éloïs
Browse files

Merge branch 'bma-ep-env' into 'dev'

fix(bma): create endpoint with env var conf

See merge request !1391
parents 99f255a9 43734ded
No related branches found
No related tags found
1 merge request!1391fix(bma): create endpoint with env var conf
...@@ -197,6 +197,19 @@ export const BmaDependency = { ...@@ -197,6 +197,19 @@ export const BmaDependency = {
service: { service: {
input: (server: Server, conf: NetworkConfDTO, logger: any) => { input: (server: Server, conf: NetworkConfDTO, logger: any) => {
// Override conf with environment variables
if (process.env.DUNITER_BMA_ENABLED) {
conf.nobma = false;
if (!conf.ipv4) {
conf.ipv4 = "127.0.0.1";
}
}
if (process.env.DUNITER_BMA_REMOTE_HOST) {
conf.remotehost = process.env.DUNITER_BMA_REMOTE_HOST;
}
if (process.env.DUNITER_BMA_REMOTE_PORT) {
conf.remoteport = parseInt(process.env.DUNITER_BMA_REMOTE_PORT);
}
// Configuration errors // Configuration errors
if (!conf.nobma) { if (!conf.nobma) {
if (!conf.ipv4 && !conf.ipv6) { if (!conf.ipv4 && !conf.ipv6) {
...@@ -211,7 +224,7 @@ export const BmaDependency = { ...@@ -211,7 +224,7 @@ export const BmaDependency = {
throw new Error("BMA: no port for remote contact."); throw new Error("BMA: no port for remote contact.");
} }
} }
if (!conf.nobma) { if (!conf.nobma || process.env.DUNITER_BMA_ENABLED) {
server.addEndpointsDefinitions(() => server.addEndpointsDefinitions(() =>
Promise.resolve(getEndpoint(conf)) Promise.resolve(getEndpoint(conf))
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment