Skip to content

Commit

Permalink
enhance(multi-dim): feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelgerber committed Aug 13, 2024
1 parent c6d89f4 commit dd97a07
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions baker/SiteBaker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
BASE_DIR,
GDOCS_DETAILS_ON_DEMAND_ID,
BAKED_GRAPHER_URL,
FEATURE_FLAGS,
} from "../settings/serverSettings.js"

import {
Expand Down Expand Up @@ -88,6 +89,7 @@ import {
import {
BAKED_BASE_URL,
BAKED_GRAPHER_EXPORTS_BASE_URL,
FeatureFlagFeature,
} from "../settings/clientSettings.js"
import pMap from "p-map"
import { GdocDataInsight } from "../db/model/Gdoc/GdocDataInsight.js"
Expand Down Expand Up @@ -756,6 +758,12 @@ export class SiteBaker {

private async bakeMultiDimPages(knex: db.KnexReadWriteTransaction) {
if (!this.bakeSteps.has("multiDimPages")) return
if (!FEATURE_FLAGS.has(FeatureFlagFeature.MultiDimDataPage)) {
console.log(
"Skipping baking multi-dim pages because feature flag is not set"
)
return
}

await bakeAllMultiDimDataPages(knex, this.bakedSiteDir)

Expand Down
5 changes: 4 additions & 1 deletion settings/clientSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ export const PUBLISHED_AT_FORMAT = "ddd, MMM D, YYYY HH:mm"
export enum FeatureFlagFeature {
MultiDimDataPage = "MultiDimDataPage",
}
const featureFlagsRaw = process.env.FEATURE_FLAGS?.trim().split(",") ?? []
const featureFlagsRaw =
(typeof process.env.FEATURE_FLAGS === "string" &&
process.env.FEATURE_FLAGS.trim()?.split(",")) ||
[]
export const FEATURE_FLAGS: Set<FeatureFlagFeature> = new Set(
Object.keys(FeatureFlagFeature).filter((key) =>
featureFlagsRaw.includes(key)
Expand Down
2 changes: 2 additions & 0 deletions settings/serverSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ export const IMAGE_HOSTING_R2_REGION: string =

export const DATA_API_URL: string = clientSettings.DATA_API_URL

export const FEATURE_FLAGS = clientSettings.FEATURE_FLAGS

export const BUILDKITE_API_ACCESS_TOKEN: string =
serverSettings.BUILDKITE_API_ACCESS_TOKEN ?? ""
export const BUILDKITE_DEPLOY_CONTENT_PIPELINE_SLUG: string =
Expand Down

0 comments on commit dd97a07

Please sign in to comment.