Skip to content

Commit 4157431

Browse files
committed
Step 3 - Add deployUrlEnvName parameter for environment variable prioritization of deployUrl.
1 parent 5852256 commit 4157431

File tree

6 files changed

+21
-0
lines changed

6 files changed

+21
-0
lines changed

apps/host-application/project.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"firstRemote": "http://localhost:4201/"
2121
}
2222
},
23+
"deployUrl": "http://localhost:4200/",
2324
"outputPath": "dist/apps/host-application",
2425
"index": "apps/host-application/src/index.html",
2526
"browser": "apps/host-application/src/main.ts",

libs/nx-angular-mf/src/builders/build/schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,10 @@
694694
},
695695
"remoteEntry": {
696696
"type": "object"
697+
},
698+
"deployUrlEnvName": {
699+
"type": "string",
700+
"description": "The name of the environment variable that contains the URL to deploy the MFE to."
697701
}
698702
},
699703
"additionalProperties": false

libs/nx-angular-mf/src/builders/helpers/prepare-config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ export async function prepareConfig(
6969
deployUrl = buildOptions.deployUrl;
7070
}
7171

72+
if (
73+
defaultOptions.deployUrlEnvName &&
74+
process.env[defaultOptions.deployUrlEnvName]
75+
) {
76+
deployUrl = process.env[defaultOptions.deployUrlEnvName];
77+
}
78+
7279
return {
7380
skipList: skipList,
7481
externalList: externalList,

libs/nx-angular-mf/src/builders/schema/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ export type SchemaMf = {
66
indexHtmlTransformer?: string;
77
exposes?: Record<string, string>;
88
remoteEntry?: Record<string, string>;
9+
deployUrlEnvName?: string;
910
};
1011
};

libs/nx-angular-mf/src/builders/schema/schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
},
5151
"remoteEntry": {
5252
"type": "object"
53+
},
54+
"deployUrlEnvName": {
55+
"type": "string",
56+
"description": "The name of the environment variable that contains the URL to deploy the MFE to."
5357
}
5458
},
5559
"additionalProperties": false

libs/nx-angular-mf/src/builders/serve/schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@
185185
},
186186
"remoteEntry": {
187187
"type": "object"
188+
},
189+
"deployUrlEnvName": {
190+
"type": "string",
191+
"description": "The name of the environment variable that contains the URL to deploy the MFE to."
188192
}
189193
},
190194
"additionalProperties": false

0 commit comments

Comments
 (0)