Add dedicated Notification API URL config for prod and test.
Introduce PROD/TEST notify-api constants, DEFAULT_NOTIFY_API_SERVER, and VITE_DEFAULT_NOTIFY_API_SERVER in env files so notification traffic can target notify-api hosts independently of APP_SERVER.
This commit is contained in:
@@ -18,4 +18,6 @@ VITE_DEFAULT_ENDORSER_API_SERVER=http://localhost:3000
|
|||||||
VITE_DEFAULT_IMAGE_API_SERVER=https://test-image-api.timesafari.app
|
VITE_DEFAULT_IMAGE_API_SERVER=https://test-image-api.timesafari.app
|
||||||
VITE_DEFAULT_PARTNER_API_SERVER=http://localhost:3000
|
VITE_DEFAULT_PARTNER_API_SERVER=http://localhost:3000
|
||||||
#VITE_DEFAULT_PUSH_SERVER... can't be set up with localhost domain
|
#VITE_DEFAULT_PUSH_SERVER... can't be set up with localhost domain
|
||||||
|
# Using shared test notify API (no local notify server by default).
|
||||||
|
VITE_DEFAULT_NOTIFY_API_SERVER=https://test-notify-api.timesafari.app
|
||||||
VITE_PASSKEYS_ENABLED=true
|
VITE_PASSKEYS_ENABLED=true
|
||||||
|
|||||||
@@ -11,3 +11,4 @@ VITE_DEFAULT_ENDORSER_API_SERVER=https://api.endorser.ch
|
|||||||
VITE_DEFAULT_IMAGE_API_SERVER=https://image-api.timesafari.app
|
VITE_DEFAULT_IMAGE_API_SERVER=https://image-api.timesafari.app
|
||||||
VITE_DEFAULT_PARTNER_API_SERVER=https://partner-api.endorser.ch
|
VITE_DEFAULT_PARTNER_API_SERVER=https://partner-api.endorser.ch
|
||||||
VITE_DEFAULT_PUSH_SERVER=https://timesafari.app
|
VITE_DEFAULT_PUSH_SERVER=https://timesafari.app
|
||||||
|
VITE_DEFAULT_NOTIFY_API_SERVER=https://notify-api.timesafari.app
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ VITE_DEFAULT_ENDORSER_API_SERVER=https://test-api.endorser.ch
|
|||||||
VITE_DEFAULT_IMAGE_API_SERVER=https://test-image-api.timesafari.app
|
VITE_DEFAULT_IMAGE_API_SERVER=https://test-image-api.timesafari.app
|
||||||
VITE_DEFAULT_PARTNER_API_SERVER=https://test-partner-api.endorser.ch
|
VITE_DEFAULT_PARTNER_API_SERVER=https://test-partner-api.endorser.ch
|
||||||
VITE_DEFAULT_PUSH_SERVER=https://test.timesafari.app
|
VITE_DEFAULT_PUSH_SERVER=https://test.timesafari.app
|
||||||
|
VITE_DEFAULT_NOTIFY_API_SERVER=https://test-notify-api.timesafari.app
|
||||||
VITE_PASSKEYS_ENABLED=true
|
VITE_PASSKEYS_ENABLED=true
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ export enum AppString {
|
|||||||
TEST1_PUSH_SERVER = "https://test.timesafari.app",
|
TEST1_PUSH_SERVER = "https://test.timesafari.app",
|
||||||
TEST2_PUSH_SERVER = "https://timesafari-pwa.anomalistlabs.com",
|
TEST2_PUSH_SERVER = "https://timesafari-pwa.anomalistlabs.com",
|
||||||
|
|
||||||
|
PROD_NOTIFY_API_SERVER = "https://notify-api.timesafari.app",
|
||||||
|
TEST_NOTIFY_API_SERVER = "https://test-notify-api.timesafari.app",
|
||||||
|
|
||||||
NO_CONTACT_NAME = "(no name)",
|
NO_CONTACT_NAME = "(no name)",
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,8 +50,6 @@ export const DEFAULT_PARTNER_API_SERVER =
|
|||||||
export const DEFAULT_PUSH_SERVER =
|
export const DEFAULT_PUSH_SERVER =
|
||||||
import.meta.env.VITE_DEFAULT_PUSH_SERVER || AppString.PROD_PUSH_SERVER;
|
import.meta.env.VITE_DEFAULT_PUSH_SERVER || AppString.PROD_PUSH_SERVER;
|
||||||
|
|
||||||
export const IMAGE_TYPE_PROFILE = "profile";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True when the current API server is not production (test/local build).
|
* True when the current API server is not production (test/local build).
|
||||||
* Use this to show dev/test-only UI (e.g. 10-minute rollover toggle, test user mnemonic).
|
* Use this to show dev/test-only UI (e.g. 10-minute rollover toggle, test user mnemonic).
|
||||||
@@ -56,6 +57,27 @@ export const IMAGE_TYPE_PROFILE = "profile";
|
|||||||
export function isNotProdServer(apiServer: string): boolean {
|
export function isNotProdServer(apiServer: string): boolean {
|
||||||
return apiServer !== AppString.PROD_ENDORSER_API_SERVER;
|
return apiServer !== AppString.PROD_ENDORSER_API_SERVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Notification API base URL for the given Endorser API server.
|
||||||
|
* Prefers VITE_DEFAULT_NOTIFY_API_SERVER when set; otherwise prod vs test/local
|
||||||
|
* follows the same isNotProdServer logic used elsewhere.
|
||||||
|
*/
|
||||||
|
export function getDefaultNotifyApiServer(apiServer: string): string {
|
||||||
|
return (
|
||||||
|
import.meta.env.VITE_DEFAULT_NOTIFY_API_SERVER ||
|
||||||
|
(isNotProdServer(apiServer)
|
||||||
|
? AppString.TEST_NOTIFY_API_SERVER
|
||||||
|
: AppString.PROD_NOTIFY_API_SERVER)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const DEFAULT_NOTIFY_API_SERVER = getDefaultNotifyApiServer(
|
||||||
|
DEFAULT_ENDORSER_API_SERVER,
|
||||||
|
);
|
||||||
|
|
||||||
|
export const IMAGE_TYPE_PROFILE = "profile";
|
||||||
|
|
||||||
export const SUPPORT_EMAIL = "info@TimeSafari.app";
|
export const SUPPORT_EMAIL = "info@TimeSafari.app";
|
||||||
|
|
||||||
export const PASSKEYS_ENABLED =
|
export const PASSKEYS_ENABLED =
|
||||||
|
|||||||
Reference in New Issue
Block a user