Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
duniter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
typescript
duniter
Commits
43734ded
Commit
43734ded
authored
3 years ago
by
Éloïs
Browse files
Options
Downloads
Patches
Plain Diff
fix(bma): create endpoint with env var conf
parent
99f255a9
No related branches found
No related tags found
1 merge request
!1391
fix(bma): create endpoint with env var conf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/modules/bma/index.ts
+14
-1
14 additions, 1 deletion
app/modules/bma/index.ts
with
14 additions
and
1 deletion
app/modules/bma/index.ts
+
14
−
1
View file @
43734ded
...
@@ -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
))
);
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment