feat: support frontend port config (#670) · chrisleekr/binance-trading-bot@dd8e1a9 · GitHub
Skip to content

Commit dd8e1a9

Browse files
authored
feat: support frontend port config (#670)
1 parent b9da5cc commit dd8e1a9

9 files changed

Lines changed: 89 additions & 23 deletions

File tree

.gitlab-ci.yml

Lines changed: 58 additions & 9 deletions

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@
1717
"cSpell.words": [
1818
"bbands",
1919
"Bollinger",
20+
"buildkitd",
2021
"buildx",
22+
"CERTDIR",
2123
"chrisleekr",
2224
"cummulative",
25+
"dind",
2326
"hgetall",
27+
"interruptible",
2428
"MACD",
2529
"mrkdwn",
2630
"redlock",

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## Unreleased
6+
7+
- Added to support frontend port configuration - [#670](https://github.com/chrisleekr/binance-trading-bot/pull/670)
8+
59
## [0.0.99] - 2024-11-04
610

711
- Added multiple TradingView indicators - [#539](https://github.com/chrisleekr/binance-trading-bot/pull/539)

app/__tests__/server-frontend.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ describe('server-frontend', () => {
192192
});
193193

194194
it('triggers server.listen', () => {
195-
expect(mockExpressListen).toHaveBeenCalledWith(80);
195+
expect(mockExpressListen).toHaveBeenCalledWith('value-frontend.port');
196196
});
197197

198198
it('triggers configureWebServer', () => {

app/frontend/local-tunnel/__tests__/configure.test.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ describe('local-tunnel/configure.js', () => {
8383
await configureLocalTunnel(mockLogger);
8484
});
8585

86-
it('does not initalise', () => {
86+
it('does not initialise', () => {
8787
expect(localTunnel).not.toHaveBeenCalled();
8888
});
8989
});
@@ -113,9 +113,9 @@ describe('local-tunnel/configure.js', () => {
113113
jest.advanceTimersByTime(300 * 1000);
114114
});
115115

116-
it('initalise with expected', () => {
116+
it('initialise with expected', () => {
117117
expect(localTunnel).toHaveBeenCalledWith({
118-
port: 80,
118+
port: 'value-frontend.port',
119119
subdomain: 'my-domain'
120120
});
121121
});
@@ -167,9 +167,9 @@ describe('local-tunnel/configure.js', () => {
167167
jest.advanceTimersByTime(60 * 60 * 1000);
168168
});
169169

170-
it('initalise with expected', () => {
170+
it('initialise with expected', () => {
171171
expect(localTunnel).toHaveBeenCalledWith({
172-
port: 80,
172+
port: 'value-frontend.port',
173173
subdomain: 'my-domain'
174174
});
175175
});
@@ -241,9 +241,9 @@ describe('local-tunnel/configure.js', () => {
241241
jest.advanceTimersByTime(60 * 60 * 1000);
242242
});
243243

244-
it('initalise with expected', () => {
244+
it('initialise with expected', () => {
245245
expect(localTunnel).toHaveBeenCalledWith({
246-
port: 80,
246+
port: 'value-frontend.port',
247247
subdomain: 'my-domain'
248248
});
249249
});
@@ -298,9 +298,9 @@ describe('local-tunnel/configure.js', () => {
298298
jest.advanceTimersByTime(60 * 60 * 1000);
299299
});
300300

301-
it('initalise with expected', () => {
301+
it('initialise with expected', () => {
302302
expect(localTunnel).toHaveBeenCalledWith({
303-
port: 80,
303+
port: 'value-frontend.port',
304304
subdomain: 'my-domain'
305305
});
306306
});
@@ -360,9 +360,9 @@ describe('local-tunnel/configure.js', () => {
360360
jest.advanceTimersByTime(60 * 60 * 1000);
361361
});
362362

363-
it('initalise with expected', () => {
363+
it('initialise with expected', () => {
364364
expect(localTunnel).toHaveBeenCalledWith({
365-
port: 80,
365+
port: 'value-frontend.port',
366366
subdomain: 'my-domain'
367367
});
368368
});

app/frontend/local-tunnel/configure.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const connect = async logger => {
4949
let tunnel;
5050
try {
5151
tunnel = await localtunnel({
52-
port: 80,
52+
port: config.get('frontend.port'),
5353
subdomain: config.get('localTunnel.subdomain')
5454
});
5555
logger.info({ url: tunnel.url }, 'Connected local tunnel');

app/server-frontend.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const runFrontend = async serverLogger => {
5353
app.use(attachmentMiddleware);
5454
app.use(express.static(path.join(global.appRoot, '/../public')));
5555

56-
const server = app.listen(80);
56+
const server = app.listen(config.get('frontend.port'));
5757

5858
if (config.get('authentication.enabled')) {
5959
const rateLimiterMiddleware = async (req, res, next) => {

config/custom-environment-variables.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
"__description": "Set a boolean to configure the bot in demo mode. If set as true, the bot will not allow updating configurations via the frontend.",
77
"__format": "boolean"
88
},
9+
"frontend": {
10+
"port": {
11+
"__name": "BINANCE_FRONTEND_PORT",
12+
"__format": "number"
13+
}
14+
},
915
"binance": {
1016
"live": {
1117
"apiKey": "BINANCE_LIVE_API_KEY",

config/default.json

Lines changed: 3 additions & 0 deletions

0 commit comments

Comments
 (0)