Packages
@buny/config

Config

šŸ’”

This module is required and peer-dependent for @buny/core package.

Introduction

Config package is extendable configuration module for buny packages.

Installation

To install the package, run the following command:

npm install @buny/config

Usage

import Config from "@buny/config";
 
declare module "@buny/config" {
  interface ExtendableConfig {
    port: number;
  }
}
 
@Usable()
class MyService {
  @Use()
  config: Config;
 
  init() {
    console.log(this.config.port);
  }
}

API

get

get configuration value by key

config.get(key: string): any;

set

set configuration value by key

config.set(key: string, value: any): void;

getEnv

get environment variable by key

config.getEnv(key: string): any;

setEnv

set environment variable by key

config.setEnv(key: string, value: any): void;

update

update configuration object

config.update(config: ExtendableConfig): void;

static update

resolve config module and update configuration object

Config.update(config: ExtendableConfig): void;