🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

rlse

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rlse

Code first feature flags

Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
3
-81.25%
Maintainers
1
Weekly downloads
 
Created
Source

rlse

Rlse (Release) is an open source library, written in Rust, that provides a simple efficient way to keep your feature flag definitions with your code making them a first class code citizen.

Installation

Install npm package

$ npm install rlse -S

Create a config file

Create a new file in the root of your project called rlse.toml.

An example config file:

[features]
testFeature1 = { environments = ['dev', 'test']}
testFeature2 = { environments = ['test']}
testFeature3 = { environments = ['dev', 'uat', 'test', 'prod']}

You can name this file anything you want, just set the RLSE_CONFIG environment variable to the name of the file if you name it something other than rlse.toml.

Be sure to include rlse.toml in your build process so it deploys with your application.

Features

The [features] section is the where the magic happens. The simplest definition looks like this.

uniqueFriendlyFeatureName = { environments = ['dev']}

This simply states that uniqueFriendlyFeatureName is enabled in the dev environment, environment is inferred from APP_ENV or passed to the test function.

Usage

Wrap your abstraction in a test.

import { is_enabled } from 'rlse';

// Will look for APP_ENV to be set
// Defaults to 'dev' environment if not set
if (is_enabled('uniqueFriendlyFeatureName')) { ... }

// Or you can pass in an environment name as the second parameter
if (is_enabled('uniqueFriendlyFeatureName', 'dev')) { ... }

is_enabled() will return false unless it finds a feature/environment combiantion defined in the config file.

FAQs

Package last updated on 29 Nov 2024

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