Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@flags-sdk/edge-config

Package Overview
Dependencies
Maintainers
4
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flags-sdk/edge-config

## Installation

latest
npmnpm
Version
0.1.0
Version published
Weekly downloads
14K
-20.74%
Maintainers
4
Weekly downloads
 
Created
Source

@flags-sdk/edge-config

Installation

npm install @flags-sdk/edge-config

Usage

Using the default adapter

This adapter will connect to the Edge Config available under the EDGE_CONFIG environment variable, and read items from a key in the Edge Config called flags.

import { flag } from '@vercel/flags/next';
import { edgeConfigAdapter } from '@flags-sdk/edge-config';

export const exampleFlag = flag({
  key: 'example-flag',
  adapter: edgeConfigAdapter(),
});

Your Edge Config should look like this:

{
  "flags": {
    "example-flag": true
  }
}

Using a custom adapter

You can specify a custom adapter which connects to a different Edge Config, and reads

import { flag } from '@vercel/flags/next';
import { createEdgeConfigAdapter } from '@flags-sdk/edge-config';

const edgeConfigAdapter = createEdgeConfigAdapter(process.env.EDGE_CONFIG, {
  teamSlug: 'your-team-slug',
  edgeConfigItemKey: 'my-flags',
});

export const exampleFlag = flag({
  key: 'example-flag',
  adapter: edgeConfigAdapter(),
});

Your Edge Config should look like this:

{
  "my-flags": {
    "example-flag": true
  }
}

Supplying the custom teamSlug allows the adapter to generate an origin for your flags, which in turn allows the Flags Explorer to link to your Edge Config. This is optional and does not affect runtime behavior.

FAQs

Package last updated on 14 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts