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

fluid-config

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fluid-config

Experimental configuration library for typescript

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

Fluid Config

An experiment in flexible configuration management

Basic usage

The goal is to be able to specify config values from multiple sources to be made available through runtime injection.

import {Value} from "fluid-config"

export class SomeClass {
	@Value() private aParam: string;
	@Value("config.var") private otherValue: string;

	public printValues() {
		console.log(this.aParam);
		console.log(this.otherValue);
	}
}

The @Value annotation will specify that a variable must be resolved from the ResolutionChain, which can contain many individual resolvers (currently environment and config.json). Additional resolvers can be specified by either setting a new ResolverChain or explicitly instantiating a Configurator instance.

import {Value, setResolutionChain, ResolutionChain, EnvirnonmentResolver} from "fluid-config"

const customChain = new ResolutionChain()
    // use built in resolver
    .register(new EnvirnonmentResolver())
    // custom resolver
    .register({resolve(path: string) {return "somevalue"}})

// Override default global chain
setResolutionChain(customChain);

export class SomeClass {
	@Value() private aParam: string;
    @Value("config.var") private otherValue: string

	public printValues() {
		console.log(this.aParam);
	}
}

FAQs

Package last updated on 04 Apr 2019

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