Skip to content

Commit 8c314eb

Browse files
committed
add correct ports in the cli ui
1 parent cd07699 commit 8c314eb

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"test": "yarn link-fix && ava",
1414
"lint": "eslint",
1515
"lint-fix": "eslint --fix ./source/**/*",
16-
"start": "node dist/cli.js"
16+
"start": "[ -e ../.env ] && set -a && . ../.env; node dist/cli.js"
1717
},
1818
"files": [
1919
"dist"

cli/source/app.tsx

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ const CliUi = () => {
4141

4242
const processRef = useRef<ChildProcessWithoutNullStreams | null>();
4343

44+
const frontend_port = process.env['PORT'];
45+
const sync_server_port = process.env['SYNC_SERVER_PORT'];
46+
const analytics_server_port = process.env['ANALYTICS_SERVER_PORT'];
47+
const db_port = process.env['DB_PORT'];
48+
const db_host = process.env['DB_HOST'];
49+
const db_name = process.env['DB_NAME'];
50+
const db_user = process.env['DB_USER'];
51+
const db_pass = process.env['DB_PASS'];
52+
const redis_port = process.env['REDIS_PORT'];
53+
const redis_host = process.env['REDIS_HOST'];
54+
4455
const runCommandOpts = useMemo<Parameters<typeof runCommand>['2']>(
4556
() => ({
4657
onData: (line) =>
@@ -69,7 +80,10 @@ const CliUi = () => {
6980
})
7081
)
7182
),
72-
log_buffer: new CircularBuffer<string>(10)
83+
log_buffer: new CircularBuffer<string>(10),
84+
options: {
85+
env: process.env
86+
}
7387
}),
7488

7589
[dispatch, lineLimit]
@@ -419,14 +433,16 @@ const CliUi = () => {
419433
<Text bold underline color="#7e57c2">
420434
Access Info
421435
</Text>
422-
<Text bold>http://localhost:3333</Text>
423-
<Text bold>http://localhost:9696</Text>
424-
<Text bold>http://localhost:6380</Text>
425-
<Text bold>http://localhost:5434</Text>
436+
<Text bold>{`http://localhost:${frontend_port}`}</Text>
437+
<Text bold>{`http://localhost:${analytics_server_port}`}</Text>
438+
<Text bold>{`redis://${redis_host}:${redis_port}/0`}</Text>
439+
<Text
440+
bold
441+
>{`postgresql://${db_user}:${db_pass}@${db_host}:${db_port}/${db_name}`}</Text>
426442
<Text bold color="grey">
427443
--
428444
</Text>
429-
<Text bold>http://localhost:9697</Text>
445+
<Text bold>{`http://localhost:${sync_server_port}`}</Text>
430446
</Box>
431447
)}
432448
</Box>

dev.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
docker-compose down
44

5-
cat env.example > .env
5+
[ ! -f .env ] && cp env.example .env
66

77
check_internet_connection() {
88
curl -s https://www.google.com > /dev/null 2>&1
@@ -41,10 +41,10 @@ update_or_add_env_var "BUILD_DATE" "$GIT_COMMIT_DATE"
4141
update_or_add_env_var "MERGE_COMMIT_SHA" "$GIT_COMMIT_HASH"
4242
update_or_add_env_var "BEHIND_COMMITS_COUNT" "$BEHIND_COMMITS_COUNT"
4343

44-
44+
set -o allexport; source .env; set +o allexport
4545
cd ./cli || exit
4646

4747
{ yarn && yarn build; } > /dev/null 2>&1
4848
yarn start
4949

50-
cd ..
50+
cd ..

0 commit comments

Comments
 (0)