@takaro/gameserver
TypeScript icon, indicating that this package has built-in type declarations

0.3.3 • Public • Published

@takaro/config

An opinionated config manager based on node-convict

Usage

import { Config, IBaseConfig } from '@takaro/config';

interface IExampleConfig extends IBaseConfig {
  test: string;
}

// This is a schema from convict
const exampleSchema = {
  test: {
    doc: 'Test value',
    format: String,
    default: 'test',
    env: 'TAKARO_TEST'
  }
};

const config = new Config<IExampleConfig>([exampleSchema]);

// ---

config.load({ test: 1 });
// Error! 'test' should be a string
config.validate();

// ---

config.load({ test: 'Hello world' });
config.get('test') // 'Hello world'

Readme

Keywords

none

Package Sidebar

Install

npm i @takaro/gameserver

Weekly Downloads

5

Version

0.3.3

License

ISC

Unpacked Size

3.31 MB

Total Files

104

Last publish

Collaborators

  • catalysm