New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@openfeature/flagd-provider

Package Overview
Dependencies
Maintainers
2
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openfeature/flagd-provider

Flagd is a simple daemon for evaluating feature flags. It is designed to conform to OpenFeature schema for flag definitions. This repository and package provides the client code for interacting with it via the OpenFeature server-side JavaScript SDK.

  • 0.8.2
  • npm
  • Socket score

Version published
Weekly downloads
4.4K
decreased by-14.72%
Maintainers
2
Weekly downloads
 
Created
Source

Server-Side flagd Provider

Flagd is a simple daemon for evaluating feature flags. It is designed to conform to OpenFeature schema for flag definitions. This repository and package provides the client code for interacting with it via the OpenFeature server-side JavaScript SDK.

Installation

$ npm install @openfeature/flagd-provider

Required peer dependencies

$ npm install @openfeature/js-sdk

Usage

The FlagdProvider supports multiple configuration options that determine now the SDK communicates with flagd. Options can be defined in the constructor or as environment variables, with constructor options having the highest precedence.

Available Options

Option nameEnvironment variable nameTypeDefaultValues
hostFLAGD_HOSTstringlocalhost
portFLAGD_PORTnumber8013
tlsFLAGD_TLSbooleanfalse
socketPathFLAGD_SOCKET_PATHstring-
cacheFLAGD_CACHEstringlrulru,disabled
maxCacheSizeFLAGD_MAX_CACHE_SIZEint1000
maxEventStreamRetriesFLAGD_MAX_EVENT_STREAM_RETRIESint5

Example Using TCP

  OpenFeature.setProvider(new FlagdProvider({
      host: 'localhost',
      port: 8013,
  }))

Example Using a Unix Socket

  OpenFeature.setProvider(new FlagdProvider({
      socketPath: "/tmp/flagd.socks",
  }))

Supported Events

The flagd provider emits PROVIDER_READY, PROVIDER_ERROR and PROVIDER_CONFIGURATION_CHANGED events.

SDK eventOriginating action in flagd
PROVIDER_READYThe streaming connection with flagd has been established.
PROVIDER_ERRORThe streaming connection with flagd has been broken.
PROVIDER_CONFIGURATION_CHANGEDA flag configuration (default value, targeting rule, etc) in flagd has changed.

For general information on events, see the official documentation.

Flag Metadata

FieldTypeValue
scopestring"selector" set for the associated source in flagd

Building

Run nx package providers-flagd to build the library.

NOTE: Buf must be installed to build locally.

Running Unit Tests

Run nx test providers-flagd to execute the unit tests via Jest.

FAQs

Package last updated on 28 Jul 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc