Skip to content

Commit

Permalink
Merge pull request #12 from splitio/example_updates
Browse files Browse the repository at this point in the history
Update README comment
  • Loading branch information
EmilianoSanchez authored Jul 12, 2023
2 parents bbf161a + 3fba32d commit 268d3fb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
1.0.1 (July 12, 2023)
- Updated README file.

1.0.0 (June 29, 2023)
- BREAKING CHANGE: the configuration parameter `edgeConfigKey` was renamed to `edgeConfigItemKey`.
- Updated wrapper to support parsed feature flag definitions.
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Keeping feature flag definitions within an Edge Config instance enables the Spli

The package includes the storage wrapper module (`src/EdgeConfigWrapper.ts`), as well as an `example` folder to quickly get started with the integration.

The project overall architecture is ilustrated in the following diagram:
The project overall architecture is illustrated in the following diagram:

<p align="center">
<img alt="Overview" src="./diagram.png" width="720">
Expand Down Expand Up @@ -47,8 +47,7 @@ The project overall architecture is ilustrated in the following diagram:
wrapper: EdgeConfigWrapper({
// The Edge Config item where Split stores feature flag definitions, specified in the Split integration step
edgeConfigItemKey: '<YOUR_EDGE_CONFIG_ITEM_KEY>',
// The Edge Config client. In this case, we are passing the default client
// that reads from the Edge Config stored in process.env.EDGE_CONFIG
// The Edge Config client
edgeConfig: edgeConfigClient,
})
}),
Expand Down
9 changes: 6 additions & 3 deletions example/pages/api/get-treatment.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { createClient } from '@vercel/edge-config';
// @REPLACE with the feature flag name you want to evaluate
const FEATURE_FLAG_NAME = 'test_split';

// Creates a client which knows how to read from Edge Config
// This client is defined outside of the handler so that it can be reused across requests
const edgeConfigClient = createClient(process.env.EDGE_CONFIG);

// Run API route as an Edge function rather than a Serverless one, because the SDK uses Fetch API to flush data, which is available in Edge runtime but not in Serverless.
export const config = { runtime: "edge" };

Expand All @@ -27,9 +31,8 @@ export default async function handler(req, event) {
wrapper: EdgeConfigWrapper({
// The Edge Config item key where Split stores feature flag definitions, specified in the Split integration step
edgeConfigItemKey: process.env.SPLIT_EDGE_CONFIG_ITEM_KEY,
// The Edge Config client. In this case, we are passing the default client
// that reads from the Edge Config stored in process.env.EDGE_CONFIG
edgeConfig: createClient(process.env.EDGE_CONFIG)
// The Edge Config client
edgeConfig: edgeConfigClient,
})
}),
// Disable or keep only ERROR log level in production, to minimize performance impact
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@splitsoftware/vercel-integration-utils",
"version": "1.0.0",
"version": "1.0.1",
"description": "Split SDK wrapper to integrate with Vercel Edge Config",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down

0 comments on commit 268d3fb

Please sign in to comment.