File tree Expand file tree Collapse file tree 6 files changed +14
-7
lines changed
packages/brain/src/modules Expand file tree Collapse file tree 6 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ export function startBrainApi({
1212 allowedOriginsFromEnv
1313} : {
1414 brainDb : BrainDataBase ;
15- allowedOriginsFromEnv : string [ ] | null ;
15+ allowedOriginsFromEnv : string | string [ ] | null ;
1616} ) : http . Server {
1717 const app = express ( ) ;
1818 app . use ( express . json ( ) ) ;
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ export const getServers = ({
3232 beaconchainApi : BeaconchainApi ;
3333 brainDb : BrainDataBase ;
3434 reloadValidatorsCronTask : CronJob ;
35- allowedOriginsFromEnv : string [ ] | null ;
35+ allowedOriginsFromEnv : string | string [ ] | null ;
3636} ) : {
3737 uiServer : http . Server ;
3838 launchpadServer : http . Server ;
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ export function startLaunchpadApi({
2929 brainDb : BrainDataBase ;
3030 network : Network ;
3131 signerUrl : string ;
32- allowedOriginsFromEnv : string [ ] | null ;
32+ allowedOriginsFromEnv : string | string [ ] | null ;
3333} ) : http . Server {
3434 const app = express ( ) ;
3535 app . use ( express . json ( ) ) ;
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ export function startUiServer({
5151 uiBuildPath : string ;
5252 brainConfig : BrainConfig ;
5353 reloadValidatorsCronTask : CronJob ;
54- allowedOriginsFromEnv : string [ ] | null ;
54+ allowedOriginsFromEnv : string | string [ ] | null ;
5555} ) : http . Server {
5656 const { network } = brainConfig . chain ;
5757 // create index.html modified with network
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ export function loadEnvs(): {
55 executionClient : ExecutionClient ;
66 consensusClient : ConsensusClient ;
77 isMevBoostSet : boolean ;
8- cors : string [ ] | null ;
8+ cors : string | string [ ] | null ;
99} {
1010 const network = getNetwork ( ) ;
1111
@@ -14,12 +14,19 @@ export function loadEnvs(): {
1414
1515 const isMevBoostSet = process . env [ `_DAPPNODE_GLOBAL_MEVBOOST_${ network . toUpperCase ( ) } ` ] === "true" ;
1616
17+ const origins = process . env . CORS ? process . env . CORS . split ( "," ) : null ;
18+ let cors : string | string [ ] | null = null ;
19+ if ( origins ) {
20+ if ( origins . length > 1 ) cors = origins ;
21+ else if ( origins . length === 1 ) cors = origins [ 0 ] ;
22+ }
23+
1724 return {
1825 network : network as Network ,
1926 executionClient,
2027 consensusClient,
2128 isMevBoostSet,
22- cors : process . env . CORS ? process . env . CORS . split ( "," ) : null
29+ cors
2330 } ;
2431}
2532
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export interface ApisConfig {
1717 token : string ;
1818 tlsCert : Buffer | null ;
1919 host : string ;
20- cors : string [ ] | null ;
20+ cors : string | string [ ] | null ;
2121}
2222
2323export interface ChainConfig {
You can’t perform that action at this time.
0 commit comments