chore: enhance data source configuration and mock data handling
- Added support for mock data mode in the frontend by introducing a new environment variable in the Dockerfile and workflow configuration. - Updated the settings page to conditionally display options based on the availability of mock data, improving user experience. - Refactored data source logic to include a check for mock data availability, ensuring proper mode handling in the application.
This commit is contained in:
1 parent
4489dfb2d6
commit
1fefed2aa0
5 files changed
+48
-23
No files matched your search
@@ -13,9 +13,14 @@ export function configuredBackendUrl(): ConfiguredBackendUrl {
|
||||
}
|
||||
|
||||
export function defaultDataSourceMode(): "mock" | "live" {
|
||||
if (!isMockDataSourceAvailable()) return "live"
|
||||
return process.env.NEXT_PUBLIC_DEFAULT_DATA_SOURCE === "live" ? "live" : "mock"
|
||||
}
|
||||
|
||||
export function isMockDataSourceAvailable(): boolean {
|
||||
return process.env.NEXT_PUBLIC_ALLOW_MOCK_DATA !== "false"
|
||||
}
|
||||
|
||||
export function isBackendUrlLocked(): boolean {
|
||||
const cfg = configuredBackendUrl()
|
||||
return cfg.kind === "same-origin" || cfg.kind === "fixed"
|
||||
|
||||
Reference in new issue
Block a user