Skip to content

Commit cf57578

Browse files
committed
Update Configure.AppHost.cs
1 parent 7eab6f2 commit cf57578

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

MyApp/Configure.AppHost.cs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,6 @@ public void Configure(IWebHostBuilder builder) => builder
1515
context.Configuration.GetSection(nameof(AppConfig)).Bind(AppConfig.Instance);
1616
services.AddSingleton(AppConfig.Instance);
1717
});
18-
19-
public override void Configure()
20-
{
21-
AppConfig.Instance.GitPagesBaseUrl ??= ResolveGitBlobBaseUrl(ContentRootDirectory);
22-
23-
SetConfig(new HostConfig
24-
{
25-
AllowFileExtensions = { "cast" }
26-
});
27-
}
28-
29-
private string? ResolveGitBlobBaseUrl(IVirtualDirectory contentDir)
30-
{
31-
var srcDir = new DirectoryInfo(contentDir.RealPath);
32-
var gitConfig = new FileInfo(Path.Combine(srcDir.Parent!.FullName, ".git", "config"));
33-
if (gitConfig.Exists)
34-
{
35-
var txt = gitConfig.ReadAllText();
36-
var pos = txt.IndexOf("url = ", StringComparison.Ordinal);
37-
if (pos >= 0)
38-
{
39-
var url = txt[(pos + "url = ".Length)..].LeftPart(".git").LeftPart('\n').Trim();
40-
var gitBaseUrl = url.CombineWith($"blob/main/{srcDir.Name}");
41-
return gitBaseUrl;
42-
}
43-
}
44-
return null;
45-
}
4618
}
4719

4820
public class AppConfig

0 commit comments

Comments
 (0)