File tree Expand file tree Collapse file tree 4 files changed +34
-4
lines changed Expand file tree Collapse file tree 4 files changed +34
-4
lines changed Original file line number Diff line number Diff line change 1- import type { RouterConfig } from "../../utils/types" ;
1+ import type { EyeballRouterConfig , RouterConfig } from "../../utils/types" ;
22
3- export const applyConfigurationDefaults = (
3+ type RequiredEyeballRouterConfig = Required < Exclude < EyeballRouterConfig , null > > ;
4+
5+ export const applyRouterConfigDefaults = (
46 configuration ?: RouterConfig
57) : Required < RouterConfig > => {
68 return {
@@ -15,3 +17,11 @@ export const applyConfigurationDefaults = (
1517 } ,
1618 } ;
1719} ;
20+
21+ export const applyEyeballConfigDefaults = (
22+ eyeballConfiguration ?: EyeballRouterConfig
23+ ) : RequiredEyeballRouterConfig => {
24+ return {
25+ limitedAssetsOnly : eyeballConfiguration ?. limitedAssetsOnly ?? false ,
26+ } ;
27+ } ;
Original file line number Diff line number Diff line change @@ -3,9 +3,13 @@ import { PerformanceTimer } from "../../utils/performance";
33import { setupSentry } from "../../utils/sentry" ;
44import { mockJaegerBinding } from "../../utils/tracing" ;
55import { Analytics , DISPATCH_TYPE , STATIC_ROUTING_DECISION } from "./analytics" ;
6- import { applyConfigurationDefaults } from "./configuration" ;
6+ import {
7+ applyEyeballConfigDefaults ,
8+ applyRouterConfigDefaults ,
9+ } from "./configuration" ;
710import type AssetWorker from "../../asset-worker" ;
811import type {
12+ EyeballRouterConfig ,
913 JaegerTracing ,
1014 RouterConfig ,
1115 UnsafePerformanceTimer ,
@@ -16,6 +20,7 @@ export interface Env {
1620 ASSET_WORKER : Service < AssetWorker > ;
1721 USER_WORKER : Fetcher ;
1822 CONFIG : RouterConfig ;
23+ EYEBALL_CONFIG : EyeballRouterConfig ;
1924
2025 SENTRY_DSN : string ;
2126 ENVIRONMENT : Environment ;
@@ -55,7 +60,8 @@ export default {
5560 ) ;
5661
5762 const hasStaticRouting = env . CONFIG . static_routing !== undefined ;
58- const config = applyConfigurationDefaults ( env . CONFIG ) ;
63+ const config = applyRouterConfigDefaults ( env . CONFIG ) ;
64+ const eyeballConfig = applyEyeballConfigDefaults ( env . EYEBALL_CONFIG ) ;
5965
6066 const url = new URL ( request . url ) ;
6167
Original file line number Diff line number Diff line change 2525 "type" : " param" ,
2626 "param" : " routerConfig" ,
2727 },
28+ {
29+ "name" : " EYEBALL_CONFIG" ,
30+ "type" : " param" ,
31+ "param" : " eyeballRouterConfig" ,
32+ "optional" : true ,
33+ },
2834 {
2935 "name" : " ASSET_WORKER" ,
3036 "type" : " internal_assets" ,
Original file line number Diff line number Diff line change @@ -20,6 +20,13 @@ export const RouterConfigSchema = z.object({
2020 ...InternalConfigSchema . shape ,
2121} ) ;
2222
23+ export const EyeballRouterConfigSchema = z . union ( [
24+ z . object ( {
25+ limitedAssetsOnly : z . boolean ( ) . optional ( ) ,
26+ } ) ,
27+ z . null ( ) ,
28+ ] ) ;
29+
2330const MetadataStaticRedirectEntry = z . object ( {
2431 status : z . number ( ) ,
2532 to : z . string ( ) ,
@@ -79,6 +86,7 @@ export const AssetConfigSchema = z.object({
7986 ...InternalConfigSchema . shape ,
8087} ) ;
8188
89+ export type EyeballRouterConfig = z . infer < typeof EyeballRouterConfigSchema > ;
8290export type RouterConfig = z . infer < typeof RouterConfigSchema > ;
8391export type AssetConfig = z . infer < typeof AssetConfigSchema > ;
8492
You can’t perform that action at this time.
0 commit comments