robots=noindex on development, staging builds

This commit is contained in:
Simon Martens
2024-11-14 16:10:39 +01:00
parent 776a5caa4e
commit c9617a8ea6
2 changed files with 30 additions and 25 deletions

View File

@@ -16,14 +16,15 @@ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
var p = builder.Configuration.GetValue<string>("WorkingTreePathWindows") + "settings.json"; var p = builder.Configuration.GetValue<string>("WorkingTreePathWindows") + "settings.json";
configpaths.Add(p); configpaths.Add(p);
builder.Configuration.AddJsonFile(p, optional: true, reloadOnChange: true); builder.Configuration.AddJsonFile(p, optional: true, reloadOnChange: true);
} else { }
else {
var p = builder.Configuration.GetValue<string>("WorkingTreePathLinux") + "settings.json"; var p = builder.Configuration.GetValue<string>("WorkingTreePathLinux") + "settings.json";
configpaths.Add(p); configpaths.Add(p);
builder.Configuration.AddJsonFile(p, optional: true, reloadOnChange: true); builder.Configuration.AddJsonFile(p, optional: true, reloadOnChange: true);
} }
// Create initial Data // Create initial Data
var tS = new XMLTestService(); var tS = new XMLTestService();
var XMLIS = new XMLInteractionService(builder.Configuration, tS); var XMLIS = new XMLInteractionService(builder.Configuration, tS);
var hdW = new HaDocumentWrapper(XMLIS, builder.Configuration); var hdW = new HaDocumentWrapper(XMLIS, builder.Configuration);
var XMLFP = new XMLFileProvider(XMLIS, hdW, builder.Configuration); var XMLFP = new XMLFileProvider(XMLIS, hdW, builder.Configuration);
@@ -43,27 +44,26 @@ builder.Services.AddFeatureManagement();
var app = builder.Build(); var app = builder.Build();
// Reload config on change // Reload config on change
var cM = new ConfigurationMonitor(configpaths.ToArray(), app.Services); // var cM = new ConfigurationMonitor(configpaths.ToArray(), app.Services);
ChangeToken.OnChange( // ChangeToken.OnChange(
() => app.Configuration.GetReloadToken(), // () => app.Configuration.GetReloadToken(),
(state) => cM.InvokeChanged(state), // (state) => cM.InvokeChanged(state),
app.Environment // app.Environment
); // );
// Websockets for realtime notification of changes // // Websockets for realtime notification of changes
app.UseWebSockets( new WebSocketOptions { app.UseWebSockets(new WebSocketOptions {
KeepAliveInterval = TimeSpan.FromMinutes(180), KeepAliveInterval = TimeSpan.FromMinutes(180),
}); });
app.UseMiddleware<WebSocketMiddleware>(); app.UseMiddleware<WebSocketMiddleware>();
// Production Options // Production Options
if (!app.Environment.IsDevelopment()) if (!app.Environment.IsDevelopment()) {
{
app.UseExceptionHandler("/Home/Error"); app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts(); app.UseHsts();
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UseForwardedHeaders(new ForwardedHeadersOptions{ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto}); app.UseForwardedHeaders(new ForwardedHeadersOptions { ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto });
} }
app.UseAuthorization(); app.UseAuthorization();

View File

@@ -1,6 +1,6 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="@ViewData["SEODescription"]"> <meta name="description" content="@ViewData[" SEODescription"]">
<title>@ViewData["Title"]</title> <title>@ViewData["Title"]</title>
@@ -9,6 +9,12 @@
<link rel="preload" href="/fonts/LinLibertine_R_G.ttf" as="font" crossorigin/> <link rel="preload" href="/fonts/LinLibertine_R_G.ttf" as="font" crossorigin/>
<link rel="preload" href="/fonts/LinBiolinum_R_G.ttf" as="font" crossorigin/> <link rel="preload" href="/fonts/LinBiolinum_R_G.ttf" as="font" crossorigin/>
--> -->
<environment names="Development, Staging">
@* Do not index this site, if development or staging *@
<meta name="robots" content="noindex" />
</environment>
@* Scripts *@ @* Scripts *@
<script src="/js/mark.min.js" asp-append-version="true" defer></script> <script src="/js/mark.min.js" asp-append-version="true" defer></script>
<script src="/js/htmx.min.js" asp-append-version="true" defer></script> <script src="/js/htmx.min.js" asp-append-version="true" defer></script>
@@ -19,20 +25,19 @@
@* Resources *@ @* Resources *@
@* We do not preload the graphics since they are embedded in the css by vite. @* We do not preload the graphics since they are embedded in the css by vite.
We dont preload here, because we have 6 requests: We dont preload here, because we have 6 requests:
(0. html & favicon) (0. html & favicon)
1. mark 1. mark
2. htmx 2. htmx
3. fonts.css 3. fonts.css
4. style.css 4. style.css
5. scripts.js 5. scripts.js
<link rel="preload" href="/img/subtlenet2.png" as="image" /> <link rel="preload" href="/img/subtlenet2.png" as="image" />
<link rel="preload" href="/fonts/LinBiolinum_Rah.ttf" as="font"/> <link rel="preload" href="/fonts/LinBiolinum_Rah.ttf" as="font" />
<link rel="preload" href="/fonts/LinBiolinum_RIah.ttf" as="font"/> <link rel="preload" href="/fonts/LinBiolinum_RIah.ttf" as="font" />
<link rel="preload" href="/fonts/LinLibertine_Rah.ttf" as="font"/> <link rel="preload" href="/fonts/LinLibertine_Rah.ttf" as="font" />
<link rel="preload" href="/fonts/LinLibertine_RZah.ttf" as="font"/> <link rel="preload" href="/fonts/LinLibertine_RZah.ttf" as="font" />
<link rel="preload" href="/fonts/LinLibertine_RIah.ttf" as="font"/> <link rel="preload" href="/fonts/LinLibertine_RIah.ttf" as="font" />
<link rel="preload" href="/fonts/LinLibertine_RBah.ttf" as="font"/> <link rel="preload" href="/fonts/LinLibertine_RBah.ttf" as="font" />
*@ *@