- AddEnvironmentVariables() where appsettings.json is read directly - JWT ValidIssuer follows RSecurityBackend:ApplicationName (was hard-coded Ganjoor) - deploy/entrypoint.sh: copy settings RSecurityBackend reads only from appsettings.json - Dockerfile: pin SDK 10.0.302 (newer Razor rejects some upstream views) - lang=ur-PK; ganjoor.net own-site links -> relative; api.ganjoor.net -> APIRoot; search.xml - DIVAN.md: first admin password is Test!123 (upstream doc is wrong) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
75 lines
2.8 KiB
C#
75 lines
2.8 KiB
C#
using Microsoft.Extensions.Configuration;
|
|
using System.IO;
|
|
|
|
namespace GanjooRazor
|
|
{
|
|
/// <summary>
|
|
/// API Root
|
|
/// </summary>
|
|
public static class APIRoot
|
|
{
|
|
/// <summary>
|
|
/// url
|
|
/// </summary>
|
|
public static string Url
|
|
{
|
|
get
|
|
{
|
|
if (!string.IsNullOrEmpty(_url))
|
|
return _url;
|
|
IConfigurationRoot configuration = new ConfigurationBuilder()
|
|
.SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json").AddEnvironmentVariables() // divan: honour env overrides (Docker)
|
|
.Build();
|
|
_url = configuration["APIRoot"];
|
|
return _url;
|
|
}
|
|
}
|
|
|
|
private static string _url = "";
|
|
|
|
private static string _InternetUrl = "";
|
|
|
|
/// <summary>
|
|
/// internet accessible end point
|
|
/// </summary>
|
|
public static string InternetUrl
|
|
{
|
|
get
|
|
{
|
|
if (!string.IsNullOrEmpty(_InternetUrl))
|
|
return _InternetUrl;
|
|
IConfigurationRoot configuration = new ConfigurationBuilder()
|
|
.SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json").AddEnvironmentVariables() // divan: honour env overrides (Docker)
|
|
.Build();
|
|
_InternetUrl = configuration["GlobalAPIRoot"];
|
|
return _InternetUrl;
|
|
}
|
|
}
|
|
|
|
private static string _semanticSearchUrl = "";
|
|
|
|
/// <summary>
|
|
/// Semantic search API endpoint — deliberately configurable separately from
|
|
/// Url/InternetUrl. Currently points at a physically separate domain/app pool
|
|
/// (ganjgah.ir) hosting the same RMuseum codebase, so that a problem with this one
|
|
/// feature (a native ONNX Runtime crash, a performance issue, anything) can't affect
|
|
/// api.ganjoor.net or the main site at all — proven necessary by an actual production
|
|
/// incident, not a hypothetical precaution. Point this at the main API root instead once
|
|
/// the feature has run stably on its own domain for a while.
|
|
/// </summary>
|
|
public static string SemanticSearchUrl
|
|
{
|
|
get
|
|
{
|
|
if (!string.IsNullOrEmpty(_semanticSearchUrl))
|
|
return _semanticSearchUrl;
|
|
IConfigurationRoot configuration = new ConfigurationBuilder()
|
|
.SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json").AddEnvironmentVariables() // divan: honour env overrides (Docker)
|
|
.Build();
|
|
_semanticSearchUrl = configuration["SemanticSearchAPIRoot"];
|
|
return _semanticSearchUrl;
|
|
}
|
|
}
|
|
}
|
|
}
|