File tree Expand file tree Collapse file tree 4 files changed +13
-5
lines changed
proxy/processors/push-action Expand file tree Collapse file tree 4 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 1- const Step = require ( '../../actions' ) . Step ;
1+ const { getServiceUIURL } = require ( '../../../service/urls' ) ;
22
3- const { GIT_PROXY_UI_PORT : uiPort } = require ( '../../../config/env ' ) . Vars ;
3+ const Step = require ( '../../actions ' ) . Step ;
44
55const exec = async ( req , action ) => {
66 const step = new Step ( 'authBlock' ) ;
7+ const url = getServiceUIURL ( req ) ;
78
89 const message =
910 '\n\n\n' +
1011 `\x1B[32mGitProxy has received your push ✅\x1B[0m\n\n` +
1112 '🔗 Shareable Link\n\n' +
12- `\x1B[34mhttp://localhost: ${ uiPort } /admin/push/${ action . id } \x1B[0m` +
13+ `\x1B[34m ${ url } /admin/push/${ action . id } \x1B[0m` +
1314 '\n\n\n' ;
1415 step . setAsyncBlock ( message ) ;
1516
Original file line number Diff line number Diff line change 11const express = require ( 'express' ) ;
22const router = new express . Router ( ) ;
33const db = require ( '../../db' ) ;
4- const { getProxyURL } = require ( '../proxyURL ' ) ;
4+ const { getProxyURL } = require ( '../urls ' ) ;
55
66router . get ( '/' , async ( req , res ) => {
77 const proxyURL = getProxyURL ( req ) ;
Original file line number Diff line number Diff line change @@ -10,4 +10,11 @@ module.exports = {
1010 ) ;
1111 return config . getDomains ( ) . proxy ?? defaultURL ;
1212 } ,
13+ getServiceUIURL : ( req ) => {
14+ const defaultURL = `${ req . protocol } ://${ req . headers . host } ` . replace (
15+ `:${ PROXY_HTTP_PORT } ` ,
16+ `:${ UI_PORT } ` ,
17+ ) ;
18+ return config . getDomains ( ) . service ?? defaultURL ;
19+ } ,
1320} ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ const chai = require('chai');
22const sinon = require ( 'sinon' ) ;
33const express = require ( 'express' ) ;
44const chaiHttp = require ( 'chai-http' ) ;
5- const { getProxyURL } = require ( '../src/service/proxyURL ' ) ;
5+ const { getProxyURL } = require ( '../src/service/urls ' ) ;
66const config = require ( '../src/config' ) ;
77
88chai . use ( chaiHttp ) ;
You can’t perform that action at this time.
0 commit comments