fix(server): judge the address search in the admin status by TREK_PHOTON_URL and an own NOMINATIM_URL

The status asked a fixed Photon origin and compared NOMINATIM_URL with the public address, so a moved Photon or an explicitly set public Nominatim showed the wrong service as in use. It now reads the same photonUrl and nominatimOwn the Photon client decides by. TREK_VALHALLA_URL joins the commented compose variables.
This commit is contained in:
Maurice
2026-10-29 10:48:55 +01:00
committed by Maurice
parent bc62eb0d6f
commit 1da7d0627a
5 changed files with 19 additions and 16 deletions
@@ -1,8 +1,2 @@
/** The issuer of installation keys: the Places host itself, so no new egress domain is needed. */
export const SERVICE_ISSUER_ORIGIN = 'https://places.liketrek.com';
/** The TREK services' Photon, the address search that stands in for the public Nominatim. */
export const PHOTON_ORIGIN = 'https://photon.liketrek.com';
/** The Nominatim TREK asks when NOMINATIM_URL names none of the admin's own. */
export const PUBLIC_NOMINATIM_URL = 'https://nominatim.openstreetmap.org';
@@ -5,8 +5,8 @@ import { SettingsService } from '../settings/settings.service';
import { IssuerClient } from './issuer.client';
import { QuotaTracker } from './quota-tracker';
import { ServiceClock } from './service-clock';
import { PHOTON_ORIGIN, PUBLIC_NOMINATIM_URL, SERVICE_ISSUER_ORIGIN } from './service-identity.constants';
import { isAllowlisted, sameServiceUrl } from './service-identity.helpers';
import { SERVICE_ISSUER_ORIGIN } from './service-identity.constants';
import { isAllowlisted } from './service-identity.helpers';
import { ServiceKeyService, type KeySnapshot } from './service-key.service';
import { Inject, Injectable } from '@nestjs/common';
import type { ConfigType } from '@nestjs/config';
@@ -77,14 +77,14 @@ export class ServiceIdentityService {
}
private originOf(service: ServiceName): string {
if (service === 'photon') return PHOTON_ORIGIN;
if (service === 'photon') return this.config.photonUrl;
return service === 'valhalla' ? this.config.valhallaUrl : SERVICE_ISSUER_ORIGIN;
}
/**
* Whether this instance asks each service right now. Places is in use
* whenever the identity is; the other two need the key itself, since they
* have no shared pool. Photon stands in for the public Nominatim only, and
* have no shared pool. Photon steps aside for an own NOMINATIM_URL, and
* the TREK Valhalla answers only where the routing choice comes to it.
*/
private async servicesInUse(key: KeySnapshot): Promise<Record<ServiceName, boolean>> {
@@ -98,7 +98,7 @@ export class ServiceIdentityService {
});
return {
places: true,
photon: keyed('photon') && sameServiceUrl(this.env.env().integrations.nominatimUrl, PUBLIC_NOMINATIM_URL),
photon: keyed('photon') && !this.env.env().integrations.nominatimOwn,
valhalla: routing === 'trek',
};
}