Skip to content

Commit 9b0ddb9

Browse files
committed
fix(appsetting): sdg
1 parent eba93f2 commit 9b0ddb9

File tree

4 files changed

+55
-27
lines changed

4 files changed

+55
-27
lines changed

.github/workflows/dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,15 +320,15 @@ jobs:
320320
# Hardcode the INDEPENDENT_CLIENT_GH_PAGES value
321321
- name: Modify appsettings.json with hardcoded value
322322
run: |
323-
jq '.INDEPENDENT_CLIENT_GH_PAGES = "true"' TestHostPrerenderWASM/TestHostPrerenderWASM.Client/appsettings.json > tmp.json && mv tmp.json TestHostPrerenderWASM/TestHostPrerenderWASM.Client/appsettings.json
323+
jq '.INDEPENDENT_CLIENT_GH_PAGES = "true"' TestHostPrerenderWASM/TestHostPrerenderWASM.Client/wwwroot/appsettings.json > tmp.json && mv tmp.json TestHostPrerenderWASM/TestHostPrerenderWASM.Client/wwwroot/appsettings.json
324324
325325
# List files in the root to ensure appsettings.json exists
326326
- name: List files in TestHostPrerenderWASM.Client
327327
run: ls -la TestHostPrerenderWASM/TestHostPrerenderWASM.Client
328328

329329
# Print the contents of appsettings.json inside 'TestHostPrerenderWASM.Client' folder
330330
- name: Display appsettings.json content
331-
run: cat TestHostPrerenderWASM/TestHostPrerenderWASM.Client/appsettings.json
331+
run: cat TestHostPrerenderWASM/TestHostPrerenderWASM.Client/wwwwroot/appsettings.json
332332

333333
- name: Publish client using client release .csproj logic
334334
run: |

TestHostPrerenderWASM/TestHostPrerenderWASM.Client/Program.cs

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,29 @@
66

77
var builder = WebAssemblyHostBuilder.CreateDefault(args);
88

9-
10-
//Console.WriteLine($"INDEPENDENT_CLIENT_GH_PAGES value: '{Environment.GetEnvironmentVariable("INDEPENDENT_CLIENT_GH_PAGES")}'");
11-
//Console.WriteLine($"INDEPENDENT_CLIENT_GH_PAGES value: '{Environment.GetEnvironmentVariable("INDEPENDENT_CLIENT_GH_PAGES", EnvironmentVariableTarget.Process)}'");
12-
13-
//if (Environment.GetEnvironmentVariable("INDEPENDENT_CLIENT_GH_PAGES", EnvironmentVariableTarget.Process) != null)
14-
15-
16-
// Access configuration value from appsettings.json
17-
var independentClientGhPages = builder.Configuration["INDEPENDENT_CLIENT_GH_PAGES"];
18-
Console.WriteLine($"INDEPENDENT_CLIENT_GH_PAGES value: {independentClientGhPages}");
19-
20-
21-
229
// Use the value in your app logic
23-
if (independentClientGhPages == "true") {
10+
var independentClientGhPagesString = builder.Configuration["INDEPENDENT_CLIENT_GH_PAGES"];
11+
bool independentClientGhPages = false; // Default value if not found or invalid
12+
13+
if (!string.IsNullOrEmpty(independentClientGhPagesString))
14+
{
15+
if (independentClientGhPagesString.ToLowerInvariant() == "true")
16+
{
17+
independentClientGhPages = true;
18+
}
19+
else if (independentClientGhPagesString.ToLowerInvariant() == "false")
20+
{
21+
independentClientGhPages = false;
22+
}
2423

24+
}
25+
if (independentClientGhPages) {
2526

26-
//if (builder.HostEnvironment.IsProduction())
27-
//{
28-
//Console.WriteLine("Condition is TRUE - Adding root components");
2927
builder.RootComponents.Add<App>("#app");
3028
builder.RootComponents.Add<HeadOutlet>("head::after");
3129
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
3230
}
33-
//else
34-
//{
35-
// Console.WriteLine("Condition is FALSE - Environment variable is null");
36-
//}
31+
3732

3833

3934
await builder.Build().RunAsync();
Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,41 @@
11
{
2+
"$schema": "http://json.schemastore.org/launchsettings.json",
3+
"iisSettings": {
4+
"windowsAuthentication": false,
5+
"anonymousAuthentication": true,
6+
"iisExpress": {
7+
"applicationUrl": "http://localhost:30155",
8+
"sslPort": 44382
9+
}
10+
},
211
"profiles": {
3-
"WSL": {
4-
"commandName": "WSL2",
5-
"distributionName": ""
12+
"http": {
13+
"commandName": "Project",
14+
"dotnetRunMessages": true,
15+
"launchBrowser": true,
16+
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
17+
"applicationUrl": "http://localhost:5290",
18+
"environmentVariables": {
19+
"ASPNETCORE_ENVIRONMENT": "Development"
20+
}
21+
},
22+
"https": {
23+
"commandName": "Project",
24+
"dotnetRunMessages": true,
25+
"launchBrowser": true,
26+
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
27+
"applicationUrl": "https://localhost:7242;http://localhost:5290",
28+
"environmentVariables": {
29+
"ASPNETCORE_ENVIRONMENT": "Development"
30+
}
31+
},
32+
"IIS Express": {
33+
"commandName": "IISExpress",
34+
"launchBrowser": true,
35+
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
36+
"environmentVariables": {
37+
"ASPNETCORE_ENVIRONMENT": "Development"
38+
}
639
}
740
}
8-
}
41+
}

TestHostPrerenderWASM/TestHostPrerenderWASM.Client/appsettings.json renamed to TestHostPrerenderWASM/TestHostPrerenderWASM.Client/wwwroot/appsettings.json

File renamed without changes.

0 commit comments

Comments
 (0)