File tree 3 files changed +14
-23
lines changed
adminSiteServer/apiRoutes
3 files changed +14
-23
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,6 @@ import {
8
8
multiDimDataPageExists ,
9
9
} from "../../db/model/MultiDimDataPage.js"
10
10
import { expectInt , isValidSlug } from "../../serverUtils/serverUtil.js"
11
- import {
12
- FEATURE_FLAGS ,
13
- FeatureFlagFeature ,
14
- } from "../../settings/clientSettings.js"
15
11
import {
16
12
upsertMultiDimConfig ,
17
13
setMultiDimPublished ,
@@ -71,10 +67,7 @@ export async function handlePutMultiDim(
71
67
const rawConfig = req . body as MultiDimDataPageConfigRaw
72
68
const id = await upsertMultiDimConfig ( trx , slug , rawConfig )
73
69
74
- if (
75
- FEATURE_FLAGS . has ( FeatureFlagFeature . MultiDimDataPage ) &&
76
- ( await multiDimDataPageExists ( trx , { slug, published : true } ) )
77
- ) {
70
+ if ( await multiDimDataPageExists ( trx , { slug, published : true } ) ) {
78
71
await triggerStaticBuild (
79
72
res . locals . user ,
80
73
`Publishing multidimensional chart ${ slug } `
Original file line number Diff line number Diff line change @@ -83,7 +83,6 @@ import { getAllImages } from "../db/model/Image.js"
83
83
import { generateEmbedSnippet } from "../site/viteUtils.js"
84
84
import { logErrorAndMaybeCaptureInSentry } from "../serverUtils/errorLog.js"
85
85
import { mapSlugsToConfigs } from "../db/model/Chart.js"
86
- import { FeatureFlagFeature } from "../settings/clientSettings.js"
87
86
import pMap from "p-map"
88
87
import { GdocDataInsight } from "../db/model/Gdoc/GdocDataInsight.js"
89
88
import { calculateDataInsightIndexPageCount } from "../db/model/Gdoc/gdocUtils.js"
@@ -810,12 +809,6 @@ export class SiteBaker {
810
809
811
810
private async bakeMultiDimPages ( knex : db . KnexReadonlyTransaction ) {
812
811
if ( ! this . bakeSteps . has ( "multiDimPages" ) ) return
813
- if ( ! FEATURE_FLAGS . has ( FeatureFlagFeature . MultiDimDataPage ) ) {
814
- console . log (
815
- "Skipping baking multi-dim pages because feature flag is not set"
816
- )
817
- return
818
- }
819
812
const { imageMetadata } = await this . getPrefetchedGdocAttachments ( knex )
820
813
await bakeAllMultiDimDataPages ( knex , this . bakedSiteDir , imageMetadata )
821
814
Original file line number Diff line number Diff line change @@ -102,16 +102,21 @@ export const GDOCS_DETAILS_ON_DEMAND_ID: string =
102
102
103
103
export const PUBLISHED_AT_FORMAT = "ddd, MMM D, YYYY HH:mm"
104
104
105
- // Feature flags: FEATURE_FLAGS is a comma-separated list of flags, and they need to be part of this enum to be considered
106
- export enum FeatureFlagFeature {
107
- MultiDimDataPage = "MultiDimDataPage" ,
108
- }
105
+ /** A map of possible features which can be enabled or disabled. */
106
+ const Features = {
107
+ ExampleFeature : "ExampleFeature" ,
108
+ } as const
109
+
110
+ type Feature = ( typeof Features ) [ keyof typeof Features ]
111
+
112
+ // process.env.FEATURE_FLAGS is a comma-separated list of flags, and they need
113
+ // to be a valid value in the Features object to be considered.
109
114
const featureFlagsRaw =
110
115
( typeof process . env . FEATURE_FLAGS === "string" &&
111
116
process . env . FEATURE_FLAGS . trim ( ) ?. split ( "," ) ) ||
112
117
[ ]
113
- export const FEATURE_FLAGS : Set < FeatureFlagFeature > = new Set (
114
- Object . keys ( FeatureFlagFeature ) . filter ( ( key ) =>
115
- featureFlagsRaw . includes ( key )
116
- ) as FeatureFlagFeature [ ]
118
+ export const FEATURE_FLAGS : Set < Feature > = new Set (
119
+ Object . values ( Features ) . filter ( ( feature ) =>
120
+ featureFlagsRaw . includes ( feature )
121
+ )
117
122
)
You can’t perform that action at this time.
0 commit comments